PHP Multiple image upload.
Posted: Sat Feb 18, 2012 6:11 pm
Hi, I am currently having problems with uploading multiple images using php scripts.
The problem is that the script runs successfully but it doesn't show up in the folder I specified.
Here is the code for the form and the php script.
In productquery.php file...
I am using a free web hosting service.
Please can anyone see me through this and help me with the complete codes to upload the files arranged and successfully...
Kind Regards.
The problem is that the script runs successfully but it doesn't show up in the folder I specified.
Here is the code for the form and the php script.
Code: Select all
echo "<label class='desc' for='prodimage'>Product Image:</label>
<input type='file' name='image[]' id='file1' tabindex='5'/><br />
<input type='file' name='image[]' id='file2' tabindex='6' /><br />
<input type='file' name='image[]' id='file3' tabindex='7' /><br />
<input type='file' name='image[]' id='file4' tabindex='8' /><br />";
Code: Select all
$target = "prodimages/";
$file = $target . basename($_FILES['image']['name'][0]);
$file = $target . basename($_FILES['image']['name'][1]);
$file = $target . basename($_FILES['image']['name'][2]);
$file = $target . basename($_FILES['image']['name'][3]);
if (($_FILES["image"]["size"][0] > 500000) || ($_FILES["image"]["size"][1] > 500000) || ($_FILES["image"]["size"][2] > 500000) ||
($_FILES["image"]["size"][3] > 500000))
{
header("location:product.php?message=4");
}
move_uploaded_file($_FILES['image']['tmp_name'], $file);Please can anyone see me through this and help me with the complete codes to upload the files arranged and successfully...
Kind Regards.