Jump to content

Can't open files in directory, but can in root.


Recommended Posts

I'm working on a site that allows users to upload documents (pdf) to they respective directories. Then on a view page, users can click a link to the open the document for viewing. The path and filename are stored in the db and the actual document is in a directory. When I hover over the link it displays the proper path and file name, but gives me the following error:

Forbidden

You don't have permission to access /docs/38/test.pdf on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache Server at theleasetracker.com Port 80

 

If I put the files in the root, and href to them, they open as they should. The permissions of the directories are 766, but I can't get the files to open even when I set it to 777. Any ideas?

Can you show the directory structure and where - exactly - you are storing the files? Are the folders with the files in directories below the root? If not, you cannot allow the user to access them directly. But, there are solutions.

 

So, please show the folders with the files in relation to the root and show what one of the URLs to the files that you output are.

Thanks for the reply. The directory structure is www/docs/userdir/files.pdf . So the files are stored in a directory 2 directories under the root directory. I just realized I can't go to the directory in the URL and get a listing of files.

Well.. That's a 403 error, not a 404, so I'd say the path is correct. However, something is preventing the Web server from accessing the files, or serving them to the client. I'd check file permissions and web server configuration. Do check for symlinks as well, as they can be troublesome for some configurations.

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.