neusight
08-03-2012, 05:41 PM
Hi all. I would like to fist say Hi as i am brand new to this site. I have a code that works great. It is an upload form that will let the user upload three files through three separate browse upload lines. Only problem with the code that I currently use is that if the user does not upload three files I get this error:
Warning: copy() [function.copy]: Filename cannot be empty in /home/dedikate/public_html/www.file-warehouse.com/multiple_upload_ac.php on line 19
Warning: copy() [function.copy]: Filename cannot be empty in /home/dedikate/public_html/www.file-warehouse.com/multiple_upload_ac.php on line 20
Here is my code:
<?php //set where you want to store files
//in this example we keep file in folder upload //$HTTP_POST_FILES['ufile']['name']; = upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path1= "upload/".$HTTP_POST_FILES['ufile']['name'][0];
$path2= "upload/".$HTTP_POST_FILES['ufile']['name'][1];
$path3= "upload/".$HTTP_POST_FILES['ufile']['name'][2];
//copy file to where you want to store file
copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1);
copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2);
copy($HTTP_POST_FILES['ufile']['tmp_name'][2], $path3);
//$HTTP_POST_FILES['ufile']['name'] = file name
//$HTTP_POST_FILES['ufile']['size'] = file size
//$HTTP_POST_FILES['ufile']['type'] = type of file
?>
I got this code from http://www.phpeasystep.com/phptu/2.html
Warning: copy() [function.copy]: Filename cannot be empty in /home/dedikate/public_html/www.file-warehouse.com/multiple_upload_ac.php on line 19
Warning: copy() [function.copy]: Filename cannot be empty in /home/dedikate/public_html/www.file-warehouse.com/multiple_upload_ac.php on line 20
Here is my code:
<?php //set where you want to store files
//in this example we keep file in folder upload //$HTTP_POST_FILES['ufile']['name']; = upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path1= "upload/".$HTTP_POST_FILES['ufile']['name'][0];
$path2= "upload/".$HTTP_POST_FILES['ufile']['name'][1];
$path3= "upload/".$HTTP_POST_FILES['ufile']['name'][2];
//copy file to where you want to store file
copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1);
copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2);
copy($HTTP_POST_FILES['ufile']['tmp_name'][2], $path3);
//$HTTP_POST_FILES['ufile']['name'] = file name
//$HTTP_POST_FILES['ufile']['size'] = file size
//$HTTP_POST_FILES['ufile']['type'] = type of file
?>
I got this code from http://www.phpeasystep.com/phptu/2.html