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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.