SharkBait Posted September 9, 2006 Share Posted September 9, 2006 Ok this is driving me nuts.I have a small script that uses move_uploaded_file() but I keep getting the Permission Denied.The file that calls move_uploaded_file() I changed its permission to 777 as well as the folder its going to.The bit of code looks like:[code]<?phpif(move_uploaded_file($file_tmp_name, "photos/{$filename}")) { // Good} else { // Not good}?>[/code][/code]The file is under 100kb in size. This is the error msg i am getting:[code]Warning: move_uploaded_file(photos/ChelseaCard.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/tingram/public_html/tingram/imageUpload.php on line 36Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpS5YP17' to 'photos/ChelseaCard.jpg' in /home/tingram/public_html/tingram/imageUpload.php on line 36Error moving file[/code]Is there a setting in php.ini I need to look at? I use this type of script on another server and it works fine...=-) Quote Link to comment Share on other sites More sharing options...
SharkBait Posted September 9, 2006 Author Share Posted September 9, 2006 Has anyone seen this happen before? Quote Link to comment Share on other sites More sharing options...
bmoremu Posted September 9, 2006 Share Posted September 9, 2006 Yes, I am having a similar problem. See the post I started yesterday labeled 'move_uploaded_file & upload_tmp_dir'. Quote Link to comment Share on other sites More sharing options...
SharkBait Posted September 10, 2006 Author Share Posted September 10, 2006 Could it be because we don't have read/write access to the tmp file on our test machines? Quote Link to comment Share on other sites More sharing options...
bmoremu Posted September 10, 2006 Share Posted September 10, 2006 How would we know? The temp directory is not part of IIS....it's on another drive actually.... Quote Link to comment Share on other sites More sharing options...
SharkBait Posted September 10, 2006 Author Share Posted September 10, 2006 Well I turned on E_Notice in the php.ini and when I tried uploading the image, I must of spelt the varible name for the temp file... But why it was giving me a Permission Denied error, why not tell me if couldnt find the tmp file I specified without having to use file_exists().But now since my little test server doesnt have GD2.0 on it, i gota figure out how to update PHP and the GD. Quote Link to comment Share on other sites More sharing options...
kenwvs Posted September 10, 2006 Share Posted September 10, 2006 Check with your host as to whether they allow CHMOD777. My host (LunarPages) does not allow you to set your permissions to this. I have been told by them to use 755 for folders and 644 for files. Try these and see what happens. Quote Link to comment Share on other sites More sharing options...
bmoremu Posted September 10, 2006 Share Posted September 10, 2006 My error is occuring on my PC where I am running IIS on XP and have set the folder to 'write' in IIS..... 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.