note 48504 deleted from features.file-upload.multiple by tularis
| From: | tularis@php.net | Date: | Mon, 27 Dec 2004 19:55:33 +0000 |
| Subject: | note 48504 deleted from features.file-upload.multiple by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82355@lists.php.net to get a copy of this message | ||
Note Submitter: item at altervista dot org
----
there is an example for multiple uploads:
<form action="<? echo $PHP_SELF; ?>" method="post"
enctype="multipart/form-data">
<input name="userfile[]" type="file"><br />
<input name="userfile[]" type="file"><br />
<input name="sendfile" type="submit" value="send">
</form>
<?
if(!$sendfile) exit();
for($i=0; $i<=count($HTTP_POST_FILES); $i++){
$image = $HTTP_POST_FILES["userfile"]["tmp_name"][$i];
$image_name = $HTTP_POST_FILES["userfile"]["name"][$i];
$image_name = str_replace(" ", "_", $image_name);
if($image_name == "") $result = "nothing to send";
elseif(file_exists($image_name)) $result = "file already exist";
else {
if(!@copy($image, $image_name)) $result = "error";
if(file_exists($image_name)) $result = "all done";
}
echo $result;
}
?>
----
Reason: bad code