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
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 | $name | Upload 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 | $name | Upload 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
Gets a count of uploads with the given field name
- Parameters:
-
string | $name | Upload field name to count |
- Returns:
- The number of files, or 0 if nothing was uploaded under that name
Gets an array of counts of uploaded files
- Returns:
- An array of upload fields in the format: [ fieldName => fileCount ]
Gets an array of parameters of all uploads
- Returns:
- An array in the format: [ fieldName => [ count => [name,type,size,tmp_name,error] ] ]
Gets an array of parameters of uploads with the given field name
- Parameters:
-
string | $name | Upload 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 | $name | Upload 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 | $field | Upload parameter to return |
string | $name | Upload 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 | $algo | The algorithm to use (such as 'MD5') |
string | $name | Upload 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 | $destinationDir | The destination directory |
string | $destinationFile | The destination filename – if using the original filename be sure to sanitize it with cleanName() |
string | $name | Upload 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: