Username: Posted October 18, 2010 Share Posted October 18, 2010 Code I'm using if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Successfully uploaded image!"; if (file_exists("img/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "img/" . $_FILES["file"]["name"]); echo "<a href='img/$filename'>Your File</a>; } } } else { echo "Invalid file"; } mysql_query("INSERT INTO $tbl (body, name, subject, ip, timestamp, img) VALUES ('$body', '$name', '$subject', '$ip', '$timestamp', '$imglink')"); mysql_query("INSERT INTO total (ip, subject, name, board) VALUES ('$ip','$subject','$name','$dfg')"); echo "<font color='red'><font size='15'><strong><center>Successfully posted to /$tbl/"; //print("<meta http-equiv='REFRESH' content='0;url=index.php?board=$tbl'>"); If I have the query on the top it runs, and the upload img doesn't && vice versa Quote Link to comment Share on other sites More sharing options...
RussellReal Posted October 18, 2010 Share Posted October 18, 2010 uhh.. yes you can.. where does $tbl get set @? Quote Link to comment Share on other sites More sharing options...
Username: Posted October 18, 2010 Author Share Posted October 18, 2010 uhh.. yes you can.. where does $tbl get set @? Above the script to upload the img. Should I move it below the script? edit> did it, same result Quote Link to comment Share on other sites More sharing options...
Buddski Posted October 18, 2010 Share Posted October 18, 2010 I am going to assume that you do not have error_reporting turned on? error_reporting(E_ALL); ini_set('display_errors',1); I say this because you have missed a quote in your code. echo "<a href='img/$filename'>Your File</a>; Quote Link to comment Share on other sites More sharing options...
Username: Posted October 18, 2010 Author Share Posted October 18, 2010 I am going to assume that you do not have error_reporting turned on? error_reporting(E_ALL); ini_set('display_errors',1); I say this because you have missed a quote in your code. echo "<a href='img/$filename'>Your File</a>; I fixed the missing quote. Sorry, typo. "Notice: Undefined variable: subject in /hosted/domains/t/e/testchan.org/public_html/create.php on line 80" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.