Results 1 to 5 of 5

Thread: Downloading Files

  1. #1

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Cool Downloading Files

    Hello!

    Heres what I want, I have files on my server, for example 1.exe, 2.zip.

    Through a PHP script I want to allow the user to download then but under a new name, for example 1.exe will be called Setup.exe and 2.zip would be Music.zip.

    I want this to go through a PHP script to incrmement a download counter, to hide the original URL and to enforce permissions.

    Thanks

  2. #2
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Downloading Files

    well a redirect header would have the page start the download. Dont know if you can change the name. What if you just change the name on upload?
    My usual boring signature: Something

  3. #3
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    Ubuntu Haters Club
    Posts
    405

    Re: Downloading Files

    PHP Code:
    header('Content-type: application/octet-stream');
    header('Content-Disposition: attachment; filename="setup.exe"');
    readfile('example1.exe'); 
    » Twitter: @rudi_visser : Website: www.rudiv.se «

    If Apple fixes security flaws, they are heralded as proactive. If Microsoft fixes a security flaw, they finally got around to fixing their buggy OS.

  4. #4

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Downloading Files

    Thanks fellas Just what I needed

  5. #5
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774

    Re: Downloading Files

    Quote Originally Posted by RudiVisser
    PHP Code:
    header('Content-type: application/octet-stream');
    header('Content-Disposition: attachment; filename="setup.exe"');
    readfile('example1.exe'); 
    As long as you are careful to send no headers you can use this to record downloads with a text file or database connection. Put the counter increment code before that code and you are all set.
    ?
    'What's this bit for anyway?
    For Jono

Posting Permissions

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



Click Here to Expand Forum to Full Width