Here is my php download mp3 script - header("Pragma: public");
-
header("Expires: 0");
-
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");header("Cache-Control: public");
-
header("Content-Description: File Transfer");
-
header("Content-Type: audio/mpeg");
-
header("Content-Disposition: attachment; filename = " . $file_name . ";");
-
header("Content-Transfer-Encoding: binary");
-
header("Content-Length: " . filesize($file));
-
@readfile($file);
and it opens my file ant it starts to download but it don't show how much time left hot to fix it?
13 1607 @tader
I believe it is up to your web browser to determine the time left for a download, not any headers you set.
Atli 5,058
Expert 4TB
Yep I would have to go with Markus on this one.
You are even sending the Content-Length header, so the browser should have all it needs to calculate this.
Perhaps you need to upgrade your browser?
Just out of curiosity, which browser are you using now?
@tader
Same version I'm using and anything I download it gives me the remaining time left for it.
maybe it's because the file size is big try to open this i tryed this script on other computer is didn't work as well
Atli 5,058
Expert 4TB
I tried this, and it does indeed appear like the "Content-Length" header is not getting through. Both Firefox and Opera download the file as if they do not know it's size.
It's weird tho, because when I request the headers, the Content-Length header is getting sent: - HEAD /_download.php HTTP/1.1
-
Host: www.mp3talpykla.com
-
Connection: close
-
-
HTTP/1.1 200 OK
-
Date: Wed, 28 Jan 2009 18:02:22 GMT
-
Server: Apache/2
-
X-Powered-By: PHP/5.2.6
-
Pragma: public
-
Expires: 0
-
Cache-Control: public
-
Content-Description: File Transfer
-
Content-Disposition: attachment; filename = Roland_Klinkenberg_-_Dusty_Horizon_(Max_Graham_club_mix_(www.mp3talpykla.com).mp3;
-
Content-Transfer-Encoding: binary
-
Content-Length: 8003580
-
Vary: Accept-Encoding,User-Agent
-
Connection: close
-
Content-Type: audio/mpeg
One thing that that might be off tho. You add a semi-colon after the filename. It shouldn't be there. Maybe that is causing some parse errors.
i deleted it and it don't work!!!
Atli 5,058
Expert 4TB
Ok. I tested your code on my test server, and it works perfectly. I get the time remaining and everything. http://atli.advefir.com/test/test.php
This is the code I used: - <?php
-
$file = "../hitakutur/Songs/Hitakutur - G-era.mp3";
-
$file_name = "Hitakutur - G-era.mp3";
-
header("Pragma: public");
-
header("Expires: 0");
-
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
-
header("Cache-Control: public");
-
header("Content-Description: File Transfer");
-
header("Content-Type: audio/mpeg");
-
header("Content-Disposition: attachment; filename=\"" . $file_name . "\"");
-
header("Content-Transfer-Encoding: binary");
-
header("Content-Length: " . filesize($file));
-
@readfile($file);
-
?>
I only made minor alterations to the Content-Disposition line. (Added the quotes around the name and removed the extra semi-colon)
So, if this code is in fact not working properly on your server, the server itself must be the problem, not the code.
Did you set the server up yourself?
well your example didn't work :|
Atli 5,058
Expert 4TB @tader
You get the time left when downloading from my server, right?
I did, at least. (using Firefox 3.0.5 on Ubuntu.)
Like I said before, if the code I posted does not work on your server, then there must be a problem with the server.
The code works, the link I provided proves that. You just need to figure out why it doesn't work on your server.
I suggest you contact your host. Perhaps they will know why this is happening.
ok than you for you help ;]
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ken |
last post by:
How do I download files from the internet server to my computer?
How do I tell the script the correct hard drive folder on my computer to
copy the files to?
After connecting to the internet...
|
by: Matthew Moran |
last post by:
I am creating a series of downloadable articles, career
tools, spreadsheets, etc. However, some of the content is
for "registered" guest. The registrants are stored in a
database and logon.
I...
|
by: Stanav |
last post by:
Hello all,
Thanks in advance for any replies...
Now, my question is: Is it possible to do a multiple files download for a
single response event on an aspx page? If there is, please give me some...
|
by: a.r.austin |
last post by:
Hello,
I am trying to download a few files one after another from a remote
server. Problem is that I don't know how to, or if I am able at all,
set a time out for download. I don't want to time...
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Many websites have a form or a link you can use to download a file. You click a form button or click...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |