Hi,
FIrst time I've had to do a multi file upload with PHP and need abiut of help - have a simple form with x4 fields top upload images. At the minute, the script works if i upload all 4 images, but if i upload say 2 and leave the remaining fields blank, I get header errors. Can anyone help?
FIrst time I've had to do a multi file upload with PHP and need abiut of help - have a simple form with x4 fields top upload images. At the minute, the script works if i upload all 4 images, but if i upload say 2 and leave the remaining fields blank, I get header errors. Can anyone help?
PHP:
$path1= "upload/".$HTTP_POST_FILES['ufile']['name'][0];
$path2= "/upload/".$HTTP_POST_FILES['ufile']['name'][1];
$path3= "/upload/".$HTTP_POST_FILES['ufile']['name'][2];
$path4= "/upload/".$HTTP_POST_FILES['ufile']['name'][3];
if (!$path1 == '') {
copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1);
$f1 = $HTTP_POST_FILES['ufile']['name'][0];
}
if (!$path2 == '') {
copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2);
$f2 = $HTTP_POST_FILES['ufile']['name'][1];
}
if (!$path3 == '') {
copy($HTTP_POST_FILES['ufile']['tmp_name'][2], $path3);
$f3 = $HTTP_POST_FILES['ufile']['name'][2];
}
if (!$path4 == '') {
copy($HTTP_POST_FILES['ufile']['tmp_name'][3], $path4);
$f4 = $HTTP_POST_FILES['ufile']['name'][3];
}
header( "Location: index.php?Upload=Yes&file1=$f1&file2=$f2&file3=$f3&file4=$f4" );