Jump to content

[SOLVED] Launch file download window using PHP? ..Maybe?


Dale_G

Recommended Posts

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. ;)

 

 

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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/

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.