Uploading files in php?

software development

#1

Hi,
I’m attempting to write a small script that will let some friends of mine upload pictures onto my account without having to use my ftp account. However, when I try to upload a test file, I get the following errors:

Warning: Unable to create ‘test.jpg’: Permission denied in /home/.esmeralda/d0llhaus/spinsugar.com/nok/admin/index.php on line 60

Warning: Unable to move ‘/tmp/phpxyfHvh’ to ‘test.jpg’ in /home/.esmeralda/d0llhaus/spinsugar.com/nok/admin/index.php on line 60

I’m only using the command move_uploaded_file($userfile, $userfile_name);

Also, I’m on the crazy domain insane plan… if that makes any difference…

http://spinsugar.com


#2

Have you set the permissions for the upload folder correlty? You will need to make the folder the files will be uploaded to read, write and executable by all.

In other words, use your FTP client to CHMOD the folder to 755 or 777. You can also log in with Telnet and do this. Whichever you prefer.


#3

Yep, that was the problem… everything works great now. I was worried that it might have been something like what ardco suggested, but it seems that one can access files from the /tmp directory as long as they do so using move_uploaded_file() instead of copy().

Thanks, dudes!

http://spinsugar.com