Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

download outside web root

Options
  • 01-07-2013 5:00pm
    #1
    Registered Users Posts: 263 ✭✭


    Hi guys quick q - Im looking to download files that are located outside the web root. During the upload process the users upload to a folder that was outside the root of the site (for security reasons). I now want to do the reverse for the admin users to download the files I have tried the following but to no avail

    I think maybe I need to add something to the conf file or the htaccess maybe - according to host permissions are ok!

    Is absolute apths an option also??

    $file=$_SERVER["DOCUMENT_ROOT"]. "/../uploads/".$filename;
    Tagged:


Comments

  • Registered Users Posts: 10,661 ✭✭✭✭maccored


    Wouldnt downloading thru ftp just be handier? or put the files in the web root, but password protect the directory?


  • Registered Users Posts: 6,494 ✭✭✭daymobrew


    Presumably the admins have to log in, if so, they could open a page/script that lists the files in upload directory and provides links to the files. The links would be to another script within document root. This will work because, while both scripts I describe will be under document root, they can reference files outside of it.

    I can write up some pseudo code if you want (too lazy atm)


  • Closed Accounts Posts: 8,016 ✭✭✭CreepingDeath


    If you were in a J2EE environment you could write a servlet to do it.

    You might also run into issues with MIME types.
    If you don't set the MIME type on the file they're downloading, they may only be able to open/save it, but without the MIME type hint the browser may not let you automatically open it with eg. Ms Office if it's a doc/xls.


Advertisement