note 25736 deleted from features.file-upload by didou
| From: | didou@php.net | Date: | Wed, 17 Sep 2003 11:55:27 +0000 |
| Subject: | note 25736 deleted from features.file-upload by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56628@lists.php.net to get a copy of this message | ||
Note Submitter: j.h.westerATplanetDOTnlHATESSPAM
----
See also my note above.
In my example the two files with no tmp_name and zero size were bigger then the max_file_size. They
are not uploaded, but excist in the $_FILES / $HTTP_POST_FILES.
I changed the script a bit so you get a error when a file is to big or is empty:
<?
function upload($FVARS) {
for($i=0;$i<count($FVARS[file][tmp_name]);$i++) {
$size=$FVARS[file][size][$i]; // filesize
$type=$FVARS[file][type][$i]; // mime type
$name=$FVARS[file][name][$i]; // original name
$temp=$FVARS[file][tmp_name][$i]; // temporary name
//whatever to do with uploaded files
echo "original name: $name<br />";
if($size > 0) {
echo "temporary name: $temp<br />";
echo "mime type: $type<br />";
echo "size: $size<hr />";
}
else {
echo "file is empty or exceeded the upload size";
}
}
}
upload($HTTP_POST_FILES); // or $_FILES or whatever
?>
to use in your form:
<input type="file" name="file[]">