Dale_G Posted May 13, 2008 Share Posted May 13, 2008 Hey everyone! Ever download something of off download.com or a similar site? Well, it pops up a confirmation window on your browser, asking you to download it. Upon checking out the code I see the source is some sort of PHP file with some string variables and the download name. So does PHP do this, or can it be set to do this for say...an MP3 file? As opposed of playing it in the browser like it would normally do, open up a download confirmation maybe send out a different header? This may just be 100% handled by the browser, but...just thought i'd check. Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted May 13, 2008 Share Posted May 13, 2008 php has nothing to do with poping up a window for download.. may have something to do with the file information for the downloading and all else to make it a dynamic element on the site. But other then that can't think of anything that would be helpful on that.. Outside of that music and video in there normal format will usually stream off the server, mostly cause of a users browser settings. To avoid streaming and force downloading your going to have to zip rar ace or otherwise compress the file. You can zip files up on the fly with php though.. Quote Link to comment Share on other sites More sharing options...
haku Posted May 13, 2008 Share Posted May 13, 2008 php has nothing to do with poping up a window for download.. Sure it does. OP - you want a 'force download' script. I have used this one in the past and it worked well for me: http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/ Quote Link to comment Share on other sites More sharing options...
btherl Posted May 13, 2008 Share Posted May 13, 2008 Popping the window is handled by javascript and the browser. But delivering the headers to tell the browser to download the file is handled by the php script and the web server. That's the basic separation of tasks. Quote Link to comment Share on other sites More sharing options...
haku Posted May 13, 2008 Share Posted May 13, 2008 javascript doesn't have anything to do with it. Maybe you can use it, but its not necessary by any means, and isnt necessary with that script for which I posted a link above. Quote Link to comment Share on other sites More sharing options...
Dale_G Posted May 13, 2008 Author Share Posted May 13, 2008 javascript doesn't have anything to do with it. Maybe you can use it, but its not necessary by any means, and isnt necessary with that script for which I posted a link above. EXACTLY what I was looking for, thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.