Jump to content


Photo

move_uploaded_file - Permissions


  • Please log in to reply
7 replies to this topic

#1 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 09 September 2006 - 12:39 AM

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:

<?php

if(move_uploaded_file($file_tmp_name, "photos/{$filename}")) {
  // Good
} else {
  // Not good
}
?>
[/code]
The file is under 100kb in size. This is the error msg i am getting:

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 36

Warning: 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 36
Error moving file

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...
=-)

#2 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 09 September 2006 - 04:26 PM

Has anyone seen this happen before?

#3 bmoremu

bmoremu
  • New Members
  • Pip
  • Newbie
  • 5 posts
  • LocationOhio, USA

Posted 09 September 2006 - 04:35 PM

Yes, I am having a similar problem. See the post I started yesterday labeled 'move_uploaded_file & upload_tmp_dir'.

#4 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 10 September 2006 - 02:45 AM

Could it be because we don't have read/write access to the tmp file on our test machines?



#5 bmoremu

bmoremu
  • New Members
  • Pip
  • Newbie
  • 5 posts
  • LocationOhio, USA

Posted 10 September 2006 - 03:19 AM

How would we know? The temp directory is not part of IIS....it's on another drive actually....

#6 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 10 September 2006 - 03:28 AM

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.



#7 kenwvs

kenwvs
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts

Posted 10 September 2006 - 04:28 AM

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.

#8 bmoremu

bmoremu
  • New Members
  • Pip
  • Newbie
  • 5 posts
  • LocationOhio, USA

Posted 10 September 2006 - 04:31 AM

My error is occuring on my PC where I am running IIS on XP and have set the folder to 'write' in IIS.....




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users