Extensive information about uploaded files

HTTP_Upload provides extensive information about uploaded files via the getProp() method:

mixed HTTP_Upload_File::getProp ( [name] )

If no value for name is provided, then this method will return an array containing all available information about the uploaded file. Otherwise the information identified by the value of this parameter will be returned as a string.

The list of possible values is determined by the contents of the $_FILES array, but is customized for the purposes of HTTP_Upload. Here are the possible properties:

  • 'name': destination file name

  • 'tmp_name': temporary uploaded file name (assigned by PHP)

  • 'form_name': name of the HTML form that submitted the uploaded file

  • 'type': Mime type of the file

  • 'size': size of the file

  • 'error': if there was an error on upload, this contains a string representing the kind of error. The errorCode() method can be used to retrieve a localized error message from this property.

Extensive information via getProp()

<?php
require_once "HTTP/Upload.php";

$upload = new HTTP_Upload("en");
$file $upload->getFiles("f");

if (
$file->isValid()) {
    echo 
"<pre>";
    
print_r($file->getProp());
    echo 
"</pre>";

    
printf("The uploaded file has the extension %s."$file->getProp("ext"));
}
?>
Examples (Previous) Internationalized Error Messages (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.