note 36885 deleted from features.file-upload by aidan
| From: | aidan@php.net | Date: | Thu, 05 Aug 2004 07:48:47 +0000 |
| Subject: | note 36885 deleted from features.file-upload by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73983@lists.php.net to get a copy of this message | ||
Note Submitter: zilinex@linuxmail.org
----
a cool function for uploading arbitrary number of files:
function upload_files($path,$overwrite=NULL,$names=NULL){
global $_FILES;
foreach($_FILES as $key => $FILE){
if( empty($FILE['name'])
|| ( empty($overwrite) &&
file_exists($path."/".basename($FILE['name'])) ) )continue;
if( !copy($FILE['tmp_name'],
$path."/".
(empty($names[$key])?basename($FILE['name']):basename($names[$key])) ))
echo "<br>Fail to copy ".$FILE['tmp_name'] ;
}
}