predator12341 Posted July 26, 2006 Share Posted July 26, 2006 Hi all the below code works fine in another project but not the one i am doing currently.the folders have chmod of 777 so no write issues UPLOAD_PATH is set to the right upload path but i just cant think y it aint working everything looks fine.please helpregardsMarksorry forgot to say it looks as if it is not getting the value inside the file input box i pass it yet it knows it is there as if i use the empty function it sees that there is something in there but when i need to use it in the below code it dont work :(Code Below$fileName = $_FILES['uploaded']['name'];$target = UPLOAD_PATH;$target = $target .'/'. $_FILES['uploaded']['name'];echo $target;$ok=1;if ($fileName =="text/php"){echo "No PHP files<br>";$ok="0";}if($ok == "0") { echo "Sorry, there was a problem uploading your file."; }else { move_uploaded_file($_FILES['uploaded']['tmp_name'], $target); } Quote Link to comment https://forums.phpfreaks.com/topic/15686-why-wont-this-upload-script-work/ Share on other sites More sharing options...
redarrow Posted July 26, 2006 Share Posted July 26, 2006 wheres the form Quote Link to comment https://forums.phpfreaks.com/topic/15686-why-wont-this-upload-script-work/#findComment-63992 Share on other sites More sharing options...
predator12341 Posted July 26, 2006 Author Share Posted July 26, 2006 here :)<form method="POST" action="pdfUploader.php">*** code here that dont get transfered***<input type="file" name="uploaded" /> *** code here that dont get transfered***<input type="submit" name="upload" value="upload" />*** code here that dont get transfered***</form> Quote Link to comment https://forums.phpfreaks.com/topic/15686-why-wont-this-upload-script-work/#findComment-63997 Share on other sites More sharing options...
ozPATT Posted July 26, 2006 Share Posted July 26, 2006 $fileName = $_FILES['uploaded']['name'];if ($fileName =="text/php")aren't you setting the filename to be the actual name of the file? not the file type? not sure if that has anything to do with anything, but just an observation... Quote Link to comment https://forums.phpfreaks.com/topic/15686-why-wont-this-upload-script-work/#findComment-64001 Share on other sites More sharing options...
predator12341 Posted July 26, 2006 Author Share Posted July 26, 2006 that line checks to see it it is file type of .php that is not setting anything == means check not make Quote Link to comment https://forums.phpfreaks.com/topic/15686-why-wont-this-upload-script-work/#findComment-64007 Share on other sites More sharing options...
predator12341 Posted July 26, 2006 Author Share Posted July 26, 2006 anyone got any thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/15686-why-wont-this-upload-script-work/#findComment-64068 Share on other sites More sharing options...
kenrbnsn Posted July 26, 2006 Share Posted July 26, 2006 You need to include [color=red]enctype="multipart/form-data"[/color] in your <form> tag.Ken Quote Link to comment https://forums.phpfreaks.com/topic/15686-why-wont-this-upload-script-work/#findComment-64074 Share on other sites More sharing options...
predator12341 Posted July 26, 2006 Author Share Posted July 26, 2006 my bad it is now fixed thanks for that ken Quote Link to comment https://forums.phpfreaks.com/topic/15686-why-wont-this-upload-script-work/#findComment-64094 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.