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 6 of 6
  1. #1
    TrainReq
    Guest

    File downloading issues

    Well... I am running this function:

    PHP Code:

    header
    ('Content-type: application/octet-stream');
    header('Content-Disposition: attachment; filename="ha.mp3"');
    readfile('http://www.site.com/blah.mp3'); 
    To more/less make the browser prompt to download the mp3... however, readfile causes the PHP to server-side read the file THEN spit out the promt to download, i need a readfile alternative so instead of reading the file, it will just automatically promt to download the file. because do to this being an offsite mp3, it takes really long to read it.

    if there is no readfile alternatives... can i do it in JS somehow?
    Last edited by TrainReq; 07-27-2007 at 09:59 AM.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You don't need readfile. Also I just tried it with readfile and the prompt is instant. I think your issue might be because you are using the absolute url. Have you tried using the relative path?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    TrainReq
    Guest
    The file i want it to download is off-site

  • #4
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    why is it off-site, why cant you host it on your site?/server?

  • #5
    TrainReq
    Guest
    I am making an mp3 file ripper which rips mp3s from another site..

  • #6
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,096
    Thanks
    11
    Thanked 101 Times in 99 Posts
    which unless you have permission form the site owner is probably a bad thing so we can't really help you further.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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