Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forbidden error for accessing PHP uploaded files

Status
Not open for further replies.

VeronicaCBurgess

Technical User
Apr 25, 2003
27
US
I was able to get a PHP upload script to work. The files are on the remote server but when I try to link to them using "<a href=" I get the following error "You don't have permission to access /interior/uploadedfile.pdf on this server".
Any ideas what I am doing wrong. Also, I am using a remote hosting service and all of the rest of my php files work fine.
Thanks
 
You need to change the permissions of the file in the upload script.
 
Check to make sure the permissions of the folder/file give all users the ability to at least read.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
Nah, this is something you do server-side.

Take a look into the chmod() function.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
either use SSH Shell login and use the command:
ssh

or (what I would recommend you):
In your FTP client, try to right click on the folder you upload to, check if you see some "read, write, execute" checkboxes..

what you want, is 755, I would imagine.
ps. I would try a manual upload via your ftp client first, to check that the problem actually is your folder permission! it might also be some error in your files, making them corrupt!

so, just try uploading whatever.txt with some text in it.
if you cannot display it, chmod the folder it's inside!

Olav Alexander Mjelde
Admin & Webmaster
 
np.

ps. I will check back in 8-10 hrs, since it's 24:00 here now.. or, actually it's 00:21, and I have to wake up for work in approx 6.5hrs.

not that you asked, but.. hmm.. here I go again.

good night.

Olav Alexander Mjelde
Admin & Webmaster
 
ok, then you have permission problems.
Did you chmod both the file and the directory?

Did you try a new upload via script, after chmod?

Olav Alexander Mjelde
Admin & Webmaster
 
?

she said it worked fine.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
I chmod'ed both the directory and the file. Now my problem is, once a user has uploaded a file from via the internet, the file cannot be accessed until I use the ftp to chmod the file. Any ideas? I am fairly new to this.
 
cLFlaVA: We made her do a work-around, to check if the files where corrupt, or if it where permission issues.

It turned out it where permission issues.

VeronicaCBurgess:
I think there are some default chmod permissions, but I dont know if your host will change them for you.

You can try the chmod like ericbrunson said.

Good luck!

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top