I currently have the ability on my website to upload photos. However, I am looking for a way to have an intermediate page that will show the files that I have selected for upload. Then have a "confirm" button.
Does anyone know of a good example of this? Also, I think I want to be able to make it ahve the ability to upload more than 1 file.
Thanks.
My current code:
<form enctype="multipart/form-data" action="uploadfile.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="50000" />
<table>
<tr>
<td align="right">Choose an image file to upload (max 50k). File will be rendered 50px x 50px, so make sure it's this small.:</td>
<td>
<input class='formFields' name="userfile" type="file" />
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Upload File" />
</tr>
</table>
</form>
uploadfile.php:
$uploadfile = $uploaddir . $_FILES['userfile']['name'];
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
$conn=mysql_connect('1.1.1.1','user','pass');
mysql_select_db("thedb");
if (!$conn)
{
exit("Connection Failed: " . $conn);
}
$thefilename = $_FILES['userfile']['name'];
$sql = "insert into files values ('" . $thefilename . "')";
$rs3=mysql_query($sql);
mysql_close($conn);
} else {
print "File upload failed...debug info:\n";
print_r($_FILES);
}
print "</pre>";