Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2007
    Location
    Canada
    Posts
    49
    Thanks
    1
    Thanked 1 Time in 1 Post

    View but not browse uploaded files

    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?

    /my_root
    /email
    /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.

  2. #2
    Supreme Master coder!
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    10,188
    Thanks
    10
    Thanked 1,166 Times in 1,157 Posts
    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.

  3. #3
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,997
    Thanks
    3
    Thanked 483 Times in 472 Posts
    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.
    Finding out HOW to do something is called research, i.e. keep searching until you find the answer. After you attempt to do something and cannot solve a problem with it yourself, would be when you ask others for help.

  4. #4
    Supreme Master coder!
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    10,188
    Thanks
    10
    Thanked 1,166 Times in 1,157 Posts
    I guess I totally missed what he was asking.

  5. #5
    New Coder
    Join Date
    Jun 2007
    Location
    Canada
    Posts
    49
    Thanks
    1
    Thanked 1 Time in 1 Post
    Thanks... that is what I thought.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •