Jump to content

[SOLVED] file download using php


maxelct

Recommended Posts

Dear All

 

I want users to be able to download a file. Its all working. When the user clicks the link the windows "File download" box pops up asking if the user wants to save/open etc.

 

Press save and the file will save. However, the estimated time left says "Not known 1.4Mb downloaded" etc.

 

How do I get it to show the estimated time left - i guess its something to do with fetching the actual file size from the server???

 

Here is the code that I have been using so far.

 

thanks in advance

 

Edward

 

$file_name= $_GET['name'];


header ("Content-Type:audio/mpeg");
header ("Content-Disposition: attachment; filename=$file_name");

readfile($file_name);

 

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.