View Full Version : View but not browse uploaded files

07-23-2007, 09:25 PM
On a shared server over which I have no configuration control...

Can PHP upload files (pic, pdf, doc...) to a folder outside/above the web root but then make them available for display in a browser via links?


/uploaded_files <--- put files here
/www <--- my html and php are in here

If so, how would I generate the links? I have tried reading the directory and creating file links with the full path (example: /server/user/my_root/uploaded_files/pic.jpg) but this doesn't work.

07-23-2007, 09:35 PM
Give us a link to the page that is displaying the links.
(even though they're wrong).

I'm thinking it will be like:

<img src="../uploaded_files/pic.jpg" alt="" />

But, if we can see your web page, we'd know.

07-23-2007, 11:26 PM
URL's for images/links... must point to http/https accessible locations. File system locations above your web document folder are not accessible through http/https requests. Likewise, things like absolute file system paths have no meaning in URL's. Remember that URL's are relative to your web document folder.

You would need to write a .php script and put it in your web space that is the target of a link that is associated with a file. The .php script would then open and read the file from the folder above your web document folder and output any necessary headers/file contents to the browser.

07-24-2007, 12:19 AM
I guess I totally missed what he was asking.

07-24-2007, 01:05 PM
Thanks... that is what I thought.