Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    4

    Default Download files by inputting exact filename

    I know this might be a strange request, but I have a website in which I will be uploading files of work I do for customers. I am trying to figure out how they can download a file without a link - in other words, I will have a text box and button, and they will have to input the exact filename to download it - preferably without the extension, i.e. .pdf or .doc, etc.
    Any help?
    Thanks
    Aaron
    Last edited by AaronV; 11-28-2007 at 08:32 PM.

  2. #2
    Registered User
    Join Date
    Apr 2004
    Posts
    4

    Default

    Maybe this question belongs in a different forum

  3. #3
    Member darren.nolan's Avatar
    Join Date
    Oct 2007
    Posts
    259

    Default

    It's not a cPanel thing, but I can point you in the right direction with PHP & headers.

    http://au.php.net/header

    <?php
    // We'll be outputting a PDF
    header('Content-type: application/pdf');

    // It will be called downloaded.pdf
    header('Content-Disposition: attachment; filename="downloaded.pdf"');

    // The PDF source is in original.pdf
    readfile('original.pdf');
    ?>

    When this file is accessed (say you make this file index.php) - the browser will just start to download your required PDF file. You can of course then make yourself a database for valid users and authenticate them etc. etc.

    The end-user then has no knowledge of where the file is coming from, and it can even "not" be in your document root (/home/username/public_html/).

    Hope this helps.

  4. #4
    Registered User
    Join Date
    Apr 2004
    Posts
    4

    Default

    Exactly! Thanks so much for your help.

  5. #5
    Member darren.nolan's Avatar
    Join Date
    Oct 2007
    Posts
    259

    Default

    Okay!

    PHP is certainly my forte, so hit me up a PM if you have troubles with it.

Similar Threads & Tags
Similar threads

  1. rar files can't download
    By Tymsah in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 08-25-2008, 12:25 AM
  2. Can I FORCE exact match in filter?
    By racassel in forum E-mail Discussions
    Replies: 1
    Last Post: 06-07-2008, 12:37 PM
  3. Exact paths to pure-ftpd, cppop, imap-courier log files?
    By Valetia in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 10-27-2006, 12:53 PM
  4. Can't download .rm files
    By smile in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 03-13-2005, 09:04 PM
  5. How to download backup files
    By wacnstac in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 03-21-2003, 11:33 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube