PupChow Posted March 20, 2006 Share Posted March 20, 2006 I am having a hard time getting the form upload script to work and I need to once again turned to the gurus for help. Everything seems to be processing, there is a long pause as during the form process as if the file is being uploaded. The problem is when I check the "uploads" folder, the file is simply not there.I made sure the form has: enctype="multipart/form-data"I made sure the "uploads" folder has the necessary permission.The input box is simply: <input name="Picture" type="file">Is there any thing else that I am missing?[code]// ==============// Configuration// ==============$uploaddir = "uploads"; // Where you want the files to upload to - Important: Make sure this folders permissions (CHMOD) is 0777!// ==============// Upload Part// ==============if(is_uploaded_file($_FILES['Picture']['tmp_name'])){move_uploaded_file($_FILES['Picture']['tmp_name'],$uploaddir.'/'.$_FILES['Picture']['name']);}print "Your file has been uploaded successfully! Yay!<br />"; [/code] Quote Link to comment https://forums.phpfreaks.com/topic/5322-form-uploaded-file-not-showing-up/ Share on other sites More sharing options...
hitman6003 Posted March 20, 2006 Share Posted March 20, 2006 Change:[code]if(is_uploaded_file($_FILES['Picture']['tmp_name']))[/code]to:[code]if ($_FILES['Picture']['size'] > 0)[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5322-form-uploaded-file-not-showing-up/#findComment-18950 Share on other sites More sharing options...
PupChow Posted March 20, 2006 Author Share Posted March 20, 2006 Thanks! Unfortunately the file is still not showing up in the uploads folder. The file is definitely being uploaded though (there was a short pause).Is there any way for it to display error msg? Quote Link to comment https://forums.phpfreaks.com/topic/5322-form-uploaded-file-not-showing-up/#findComment-18952 Share on other sites More sharing options...
PupChow Posted March 20, 2006 Author Share Posted March 20, 2006 Just a little bit more info, I tried the upload code at PHP manual and got the following result:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Possible file upload attack!Here is some more debugging info:Array( [Picture] => Array ( [name] => DrJohnson_Panda5.gif [type] => image/gif [tmp_name] => C:\PHP\uploadtemp\phpCD9D.tmp [error] => 0 [size] => 25752 ))Entry successfully added.[/quote]The code is as followed:[code]$uploaddir = '/c:/hosting/webhost4life/member/mychow/uploads/'; // I tried both /c: and c: //$uploadfile = $uploaddir . basename($_FILES['Picture']['name']);echo '<pre>';if (move_uploaded_file($_FILES['Picture']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n";} else { echo "Possible file upload attack!\n";}echo 'Here is some more debugging info:';print_r($_FILES);print "</pre>";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5322-form-uploaded-file-not-showing-up/#findComment-18955 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.