I've been messing with this all afternoon and it is not working. What I'm trying to do is upload an image, then have PHP automatically make a copy of the image, resize it to 160 x 120, and save the copy with a dif file name. Uploading the image works fine.... the thumbnail part is hard.
heres the code that i have just to upload the image --- i took out the code that was supposed to resize the image... what would I do and how would i do it?
<html>
<? $gametitle = stripslashes($gametitle); ?>
<form action="<? $PHP_SELF ?>" method=post enctype="multipart/form-data">
Upload:<input type=hidden name=MAX_FILE_SIZE value=10000000000>
<input type=file name="userfile"><br>
<input type="hidden" name="gameid" value="<? echo $gameid ?>">
<input type="hidden" name="gametitle" value="<? echo $gametitle ?>">
<input type="hidden" name="system" value="<? echo $system ?>">
<input type=submit value="Upload!" name=submit><br>
</form>
<?
echo "<B>Add $gametitle Screenshots</B><P>";
if($submit) {
if(!empty($userfile)) {
$date = date("gismdY");
$rand = rand(1,20);
$complete = $date.$rand;
$type = split(".",$userfile_name,2);
$type2 = $type["1"];
copy($userfile, "/home/virtual/site10/fst/var/www/html/imgupload/$complete.$type2");
unlink($userfile);
* I Had the code that would make a copy of the uploaded image to a smaller copy and rename it , obviously didn't work*
$db = mysql_connect("localhost", "xxx", "xxx");
mysql_select_db("robsgaming",$db);
mysql_query("INSERT INTO imgupload (filename,gameid,gametitle,system) VALUES ('$complete.$type2','$gameid','$gametitle','$system')");
echo("$complete.$type2 file uploaded");
}
}
?>
</html>
Please reply back. If anybody can help me get this working I'll pay you $5 or so on pay pal...