note 6911 modified in Uploading multiple files by ronabop
| From: | ronabop@php.net | Date: | Sat, 09 Sep 2000 03:19:16 +0000 |
| Subject: | note 6911 modified in Uploading multiple files by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4596@lists.php.net to get a copy of this message | ||
First off, sorry for al the posts, but the end result is worth it. I have a solution to all problems
with multiple uploads... Here it is:
<?php
global $uploadfile, $upload_dir, $filename, $filenames, $thetime;
$thetime = time();
umask(000);
mkdir("/home/httpd/html/uploadphp/uploads/$thetime",0777);
// Wherever you have write permission below...
$upload_dir = "/home/httpd/html/uploadphp/uploads/$thetime";
for($i = 0; $i <= 11; $i = ($i + 3)) {
for($i = 0; $i <= 12; $i++) {
$filename = "$upload_dir/$uploadfile[$i]";
$filenames .= "$uploadfile[$i], ";
copy($uploadfile[$i + 2], $filename);
unlink($uploadfile[$i + 2]);
}
echo "$filenames uploaded sucessfully to $upload_dir.";
?>
Hope you all can read this. I have tested it of course and it works flawlessly. You can add to it,
just remember to change $i's greatest value in increments of 3 (0,3,6,9,12,etc) for the amounts
of upload spaces you have in html.
For the html use (brackets omitted):
INPUT TYPE="FILE" NAME="uploadfile[]"
Any questions email me.
I hope this note looks good on post ;-)
http://www.php.net/manual/uploading-multiple-files.php