My Project
 All Data Structures Files Functions Variables Pages
Public Member Functions
Puploads Class Reference

Public Member Functions

 __construct ()
 fileCount ($name)
 fileList ()
 getAll ()
 getAllForName ($name)
 getAllForUpload ($name, $number=0)
 getFieldForUpload ($field, $name, $number=0)
 error ($name, $number=0)
 move ($destinationDir, $destinationFile, $name, $number=0)
 hash ($algo, $name, $number=0)
 cleanName ($name, $number)

Constructor & Destructor Documentation

__construct ( )

Creates a new instance of a Puploads object


Member Function Documentation

cleanName (   $name,
  $number 
)

Returns a "clean" filename (characters that aren't alphanumeric, periods, or dashes are replaced with underscores) for a single uploaded file

Parameters:
string$nameUpload field name
int$number(optional) The upload number, if more than one file was uploaded under the same field name
Returns:
The cleaned filename
error (   $name,
  $number = 0 
)

Gets the error, if any, for a single upload

Parameters:
string$nameUpload field name
int$number(optional) The upload number, if more than one file was uploaded under the same field name
Returns:
The error code, or 0 if no error occurred
fileCount (   $name)

Gets a count of uploads with the given field name

Parameters:
string$nameUpload field name to count
Returns:
The number of files, or 0 if nothing was uploaded under that name
fileList ( )

Gets an array of counts of uploaded files

Returns:
An array of upload fields in the format: [ fieldName => fileCount ]
getAll ( )

Gets an array of parameters of all uploads

Returns:
An array in the format: [ fieldName => [ count => [name,type,size,tmp_name,error] ] ]
getAllForName (   $name)

Gets an array of parameters of uploads with the given field name

Parameters:
string$nameUpload field name
Returns:
An array in the format: [ count => [name,type,size,tmp_name,error] ]
getAllForUpload (   $name,
  $number = 0 
)

Gets an array of parameters of a single upload with the given field name

Parameters:
string$nameUpload field name
int$number(optional) The upload number, if more than one file was uploaded under the same field name
Returns:
An array in the format: [name,type,size,tmp_name,error]
getFieldForUpload (   $field,
  $name,
  $number = 0 
)

Gets one parameter of a single upload with the given field name

Parameters:
string$fieldUpload parameter to return
string$nameUpload field name
int$number(optional) The upload number, if more than one file was uploaded under the same field name
Returns:
The parameter's string or integer
hash (   $algo,
  $name,
  $number = 0 
)

Calculates the hash of a single uploaded file

Parameters:
string$algoThe algorithm to use (such as 'MD5')
string$nameUpload field name
int$number(optional) The upload number, if more than one file was uploaded under the same field name
Returns:
The parameter's string or integer
move (   $destinationDir,
  $destinationFile,
  $name,
  $number = 0 
)

Moves an uploaded file to the specified destination

Parameters:
string$destinationDirThe destination directory
string$destinationFileThe destination filename – if using the original filename be sure to sanitize it with cleanName()
string$nameUpload field name
int$number(optional) The upload number, if more than one file was uploaded under the same field name
Returns:
The parameter's string or integer

The documentation for this class was generated from the following file: