note 50178 added to function.move-uploaded-file
| From: | pedro_sacramento at yahoo dot com | Date: | Sun, 20 Feb 2005 22:10:14 +0000 |
| Subject: | note 50178 added to function.move-uploaded-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-85294@lists.php.net to get a copy of this message | ||
Here is a sample script for uploading multiple files at once.
<!-- index.php - starts here -->
<?
if ($_GET['cmd'] == "upload")
{
for ($i = 0 ; $i < count($_FILES['sample']['name']) ; $i++){
move_uploaded_file(
$_FILES['sample']['tmp_name'][$i],
"upload_dir/".$_FILES['sample']['name'][$i]
);
}
}
?>
<html>
<body>
<form action=index.php?cmd=upload method=post enctype="multipart/form-data">
<input type=file name=sample[]><br>
<input type=file name=sample[]><br>
<input type=file name=sample[]><br>
<input type=hidden name=MAX_FILE_SIZE value=1024>
<input type=submit>
</form>
</body>
</html>
<!-- index.php - ends here -->
Hope it helps :)
<Pedro Sacramento/>
----
Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50178
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50178&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50178&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50178&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50178&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50178&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50178&report=yes
Search -- http://master.php.net/manage/user-notes.php