Results 1 to 11 of 11

Thread: How can I Build a File Download Script ?
      
   

  1. #1
    bothamspy is offline First Sergeant
    Join Date
    Mar 2008
    Posts
    70

    Default How can I Build a File Download Script ?

    Thanks to all who assist!

    I need to create a simple download script to download files (gif images) from my site that are not zip files.

    If anyone knows where I can get one, please let me know

    Thanks,

    Tom

  2. #2
    Karen Mac's Avatar
    Karen Mac is offline General
    Join Date
    Apr 2006
    Location
    X marks the spot
    Posts
    8,353

    Default Re: How can I Build a File Download Script ?

    You can simply link to the picture and they right click save as or save target as. No script needed.

    Karen

    VodaHost

    Your Website People!
    1-302-283-3777 North America / International
    07031847328 / United Kingdom

    ------------------------

    Top 3 Best Sellers

    Web Hosting - Unlimited disk space & bandwidth.

    Reseller Hosting - Start your own web hosting business.

    Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)



  3. #3
    bothamspy is offline First Sergeant
    Join Date
    Mar 2008
    Posts
    70

    Default Re: How can I Build a File Download Script ?

    I am looking to an alternative to the right click option.

    Thanks

  4. #4
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,313

    Default Re: How can I Build a File Download Script ?

    Are you looking for a PAID download script or are these for free ?¿

  5. #5
    bothamspy is offline First Sergeant
    Join Date
    Mar 2008
    Posts
    70

    Default Re: How can I Build a File Download Script ?

    Free would be best

    thanks

  6. #6
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,313

  7. #7
    bothamspy is offline First Sergeant
    Join Date
    Mar 2008
    Posts
    70

    Default Re: How can I Build a File Download Script ?

    yes, the images are free to download

    Thanks for the response. Any suggestions would be appreciated.

    Tom

  8. #8
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,313

    Default Re: How can I Build a File Download Script ?

    Well you have the 2 suggestions

    click and save/download
    or a zip file.............

    cant think of anything else.

  9. #9
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default Re: How can I Build a File Download Script ?

    Or use a downloader script...... There are specific ones, depending on whether the file type and size are stored somewhere or not. Or, you may pass the type and size your self.

    Here is one:
    <?php
    $fileID = $_GET['fileID'];
    $file_path = $_GET['product_file_path'];
    $file_name = $_GET['product_file_Name'];
    $file_size = $_GET['product_file_Size'];
    $file_type = $_GET['product_file_Type'];
    header("Pragma: public");
    header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private",false);
    header("Content-type: Application/ $file_type");
    header("Content-Disposition: attachment; filename=$file_name");
    header("Content-Description: Download PHP");
    header("Content-Length: $file_size");
    header("Content-Transfer-Encoding: binary");
    set_time_limit(0);
    $fp = fopen($file_path, 'r');
    $data = fread($fp, $file_size);
    fclose($fp);
    echo $data;
    ?>

    In this one, the button to download should contain a link like

    http://www.yourdomain.com/downloader.php?file_size=1234&file_type=image/jpg&filename=My_image_title&filepath=foldername/file.jpg
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  10. #10
    bothamspy is offline First Sergeant
    Join Date
    Mar 2008
    Posts
    70

    Default Re: How can I Build a File Download Script ?

    Navaldesign

    Thank you for the help, but I am still a little confused on how to use this script:

    http://www.yourdomain.com/downloader...rname/file.jpg

    Any assistance will be greatly appreciated

    Thanks

    Tom

  11. #11
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default Re: How can I Build a File Download Script ?

    Save the script as "downloader.php" using notepad. Upload it on your site, in the same folder where the files you want to allow download for, are.

    Then, when you create the links for the downloads, you need to create the link as explained above.

    The parametres in the link MUST be specified by you, case per case.
    There are some other scripts that will only need to pass with the link, the file path. But, not all server settings allow automatic recognition of the file type and file size. So it is best if for every file, you specify these details yourself.

    Example: let's suppose that you have an image file, named my_image.jpg. Being JPG, it's type is image/jpeg Let's also suppose that the file is stored in the directory under the directory where the script is saved, directory name images, and that it has a size of 158689 Bytes. Let's also suppose that you want to send this image to the visitor as "sunset.jpg"

    The link from your page to the script, should be:


    The link should be:

    http://www.yourdomain.com/downloader.php?file_size=158869&file_type=image/jpeg&filename=sunset.jpg&filepath=images/my_image.jpg
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49