<?php
if(isset($HTTP_POST_VARS["submit"]))
{
if ($HTTP_POST_FILES['userfile']['tmp_name'] == "none"){
echo "<center><br><br><br>You must enter an image</center>";
exit();
}
$target = "images/";
if (is_dir($target) AND is_writable($target))
{
$filename = $HTTP_POST_FILES['userfile']['name'];
copy($HTTP_POST_FILES['userfile']['tmp_name'], "$target/$filename");
echo "$filename has been received.";
echo "<form action='addreview.php' method='post'>
<input type='hidden' name='rev_cover' value=".$filename.">
<input name='proceed' type='submit' value='Proceed'>
</form>";
exit();
}
else
echo $target_dir. ': either invalid or write permission denied';
}
?>
obviously you need to change it to work with your site, but play around with it. it works for me, the only place you might run into a problem is with unique filenames, if two filenames are the same i believe it will overwrite the first one.
here is the html form code to use with it:
<form enctype="multipart/form-data" action="<?PHP $PHP_SELF ?>" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="500000000">
<input name="userfile" type="file" size="50">
<br>
<center>
<input name="submit" type="submit" value="Send File"></center>
</form>
also, if you dont want to deal with that, there is a good tutorial at the following link which shows how to store images in a mysql database. i couldnt get it to work, but im still very new to php, but you might be able to. if it works it would be a sweet little feature.
http://www.webdatabasebook.com/upload/index.php