note 48504 added to features.file-upload.multiple
| From: | item at altervista dot org | Date: | Mon, 27 Dec 2004 15:27:25 +0000 |
| Subject: | note 48504 added to features.file-upload.multiple | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-82347@lists.php.net to get a copy of this message | ||
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;
}
?>
----
Manual Page -- http://www.php.net/manual/en/features.file-upload.multiple.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48504
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48504&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48504&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48504&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48504&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48504&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48504&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48504&report=yes
Search -- http://master.php.net/manage/user-notes.php