Question Locked

PHP Permission to Uploaded File

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I recently took over the website for my company and it contains PHP code which I am still very unfamiliar with but am in the process of learning. On the site clients can upload data files (.txts) by browsing for the file and clicking "submit" (within a form) which activates a PHP file that has the uploaded file stored in a specific folder on the site's server so we may download them later. The problem is when we go to download the files from the server we get this:

test_site_upload.txt: Permission denied

Requested action not taken (e.g., file or directory not found, no access).

I inquired what this meant or what caused this with our host and they said:

"The issue is that your uploader script is uploading the filees under the username of the web server itself. You need to dictate within the code a proper permissions/ownership variable so that the files are uploaded as your username."

I've verified that the destination folder has full permissions (777) but the problem persists. I'm stumped, help would be much appreciated.

4 replies

by tig2

While I'm not a wizard with PHP, it sounds to me as if permissions are not the issue but rather an incorrect user name being captured by your script. It sounds like the web server's name is being captured and sent and not the user name that should be associated with the file. From your ISP's response, it sounds like the script needs to be modified.

Good luck!

by im patrickb8man

After doing some more research I happened to stumble upon the answer (which now that I think about it was quite obvious): the PHP script required a line of code that essentially would take each file uploaded and manually assign it specific permissions that I would declare. Here's where I found it:
http://uk2.php.net/manual/en/function.chmod.php

by tig2

Sounds like you have the answer!

Happy New Year :)

This discussion is closed to new replies.