Jump to content

move_uploaded_file - Permissions


SharkBait

Recommended Posts

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]
<?php

if(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 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
[/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...
=-)
Link to comment
https://forums.phpfreaks.com/topic/20188-move_uploaded_file-permissions/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.