Class: UploadedFile

  • Package: saf.CGI
  • Author: John Luxford <lux@simian.ca>
  • Copyright: Copyright (C) 2001-2003, Simian Systems Inc.
  • License: http://www.sitellite.org/index/license Simian Open Software License
  • Version: 1.6, 2003-01-24, $Id: UploadedFile.php,v 1.3 2007/10/06 00:06:30 lux Exp $
  • Access: public

This class add to the CGI class by providing a simplified means of
dealing with uploaded files.

New in 1.4:
- Fixed a bug in the move() method.

New in 1.6:
- Added the get() method.


Usage Example


<?php

$file 
= new UploadedFile ($HTTP_POST_FILES['filename']);

$file->move ('/new/path/to''file');

?>

Return to Top



Properties


$param = array ()

  • Access: public

Contains a list of the names of all the cookie variables
available to the current script.


$files = array ()

  • Access: public

Contains a list of the names of all the file upload variables
passed to the current script through the POST method.


$error

  • Access: public

Contains an error message that may have been created during
the execution of a transform() call.


$name

  • Access: public

The name of the uploaded file.


$contentType

  • Access: public

The HTTP content type of the pushed document. This can
be either multipart/mixed or multipart/x-mixed-replace, depending
on what you tell the constructor method.


$extraHeaders

  • Access: public

A list of extra HTTP headers to send by sendHeaders().


$key

  • Access: public

The unique key used to separate pushed data blocks. This
value is generated on the fly for you.


$type

  • Access: public

The mime type of the uploaded file.


$size

  • Access: public

The size of the uploaded file.


$tmp_name

  • Access: public

The full path and name to the temporary upload file.

Return to Top



Methods


UploadedFile ($hash)

  • Access: public

Constructor method.


move ($to_path, $to_file = '')

  • Access: public
  • Return: boolean

Moves the file to the specified location. The $to_file
parameter is optional. You can include the name of the file
in the first paraemeter, or use the second, but if so, make sure
the $to_path parameter does not end with a trailing slash (/).


get ()

  • Access: public
  • Return: string

Gets the contents of the file as one big fat string, so you
can do with them as you please.

Return to Top

Copyright © 2008 Sitellite CMS Project

Powered by Sitellite 5.0 Content Management System