PHP - how do i upload more than one image at a time

Asked By Olusegun A. on 28-Aug-10 12:45 PM
please i have this more that i want to use in uploading 5 images at a time, but i don't know how to upload the files into my upload folder;

<form action="<?php echo $_SESSION['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" name="form1" id="form1">
<table width="300" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td align="center"><label>
<input type="file" name="file" />
</label></td>
</tr>
<tr>
<td align="center"><label>
<input type="file" name="file2" />
</label></td>
</tr>
<tr>
<td align="center"><label>
<input type="file" name="file3" />
</label></td>
</tr>
<tr>
<td align="center"><label>
<input type="file" name="file4" />
</label></td>
</tr>
<tr>
<td align="center"><p>
<label>
<input type="file" name="file5" />
</label>
</p>
</td>
</tr>
</table>
<p align="center">
<label>
<input type="submit" name="Submit" value="Upload" />
</label>
</p>
</form>

i tried using this move to folder code;

$file_name = ($_FILES["file"]["name"]);
$random_digit=rand(00000,99999);
$new_file_name=$random_digit . $imageResized;

if (($_FILES["file"]["name"]!="") && file_exists("../upload/" . $new_file_name))
{
echo "<span class='style3'>Please reupload the Picture.</span>";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"../upload/" . $new_file_name);
$path2= "../upload/" . $new_file_name;

but someone advised i put it in an array but i don't know how to go about that. please ow can i do this or which other less stress way can i do this.

regards
Web Star replied to Olusegun A. on 29-Aug-10 02:05 AM

See this link how could you uploda multiple file at one time in php
http://www.plus2net.com/php_tutorial/php_multi_file_upload.php