So I started with a code I found on http://lpmj.net/7.php (example 15) which uploads an image, writes it to a variable, and displays it. I want to modify it so that it instead writes it to an array and then displays, and then I can continue to upload images to subsequent array position and display them all, as opposed to just the most recent, as is the case now. You can see I set it up to put in an array and then after displaying, move to the next position, but given that the HTML that creates the button is not dynamic, I sort of get stuck. Here's what I have now:
Thanks!
Code:
<?php // upload.php
$m=0;
echo <<<_END
<html><head><title>PHP Form Upload</title></head><body>
<form method='post' action='upload.php' enctype='multipart/form-data'>
Select File: <input type='file' name='filename' size='10' />
<input type='submit' value='Upload' />
</form>
_END;
display();
function display(){
if ($_FILES)
{
$name[$m] = $_FILES['filename']['name'];
move_uploaded_file($_FILES['filename']['tmp_name'], $name[$m]);
echo "Uploaded image '$name[$m]'<br /><img src='$name[$m]' />";
$m++;
}
}
echo "</body></html>";
?>
Thanks!