By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,212 Members | 2,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,212 IT Pros & Developers. It's quick & easy.

resume downloads

P: n/a
I want send my zip files in my page from inside php.
With this I know how many people have download my file and other information.

My problem is this, I have this code but it dosn't resume broken downloads.
What I can do for this?
-------------------
<?php
header('Content-type: application/zip');

$fp = fopen('file.zip', 'rb');
while (!feof($fp))
echo fread($fp, 1024);
fclose($fp);
?>
---------------------
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"<- Chameleon ->" <ch******@hotmail.NOSPAM.com> wrote in message news:<bn**********@nic.grnet.gr>...
I want send my zip files in my page from inside php.
With this I know how many people have download my file and other information.

My problem is this, I have this code but it dosn't resume broken downloads.
What I can do for this?
-------------------
<?php
header('Content-type: application/zip');

$fp = fopen('file.zip', 'rb');
while (!feof($fp))
echo fread($fp, 1024);
fclose($fp);
?>
---------------------


This won't work for resume download. You need to parse the
request header of the download manager (HTTP_RANGE) and echo only that
range using fseek or something. Also you need to send the proper
header
(ie, something like header('Content-Range: bytes 0-200/1024'))

You may even get nice PHP script by Googling.

---
"US got a nuclear bomb that can destroy the world 13 times. Russia
got a nuclear bomb that can destroy the world 7 times. But...my
friend! Tell me! CAN YOU KILL A MAN TWICE??!!!!!" -- P.A.Sangma, Peace
loving Indian politician against India's step to go for a nuclear
test.
Email: rrjanbiah-at-Y!com
Jul 17 '05 #2

P: n/a
> > I want send my zip files in my page from inside php.
With this I know how many people have download my file and other information.

My problem is this, I have this code but it dosn't resume broken downloads.
What I can do for this?
-------------------
<?php
header('Content-type: application/zip');

$fp = fopen('file.zip', 'rb');
while (!feof($fp))
echo fread($fp, 1024);
fclose($fp);
?>
---------------------


This won't work for resume download. You need to parse the
request header of the download manager (HTTP_RANGE) and echo only that
range using fseek or something. Also you need to send the proper
header
(ie, something like header('Content-Range: bytes 0-200/1024'))


Thank you friend. The key-word was "Content-Range" in Google...
Because html headers does many usefull things (I see this now ;-), where can I found a reference to all possible html headers?

thank you again
Jul 17 '05 #3

P: n/a
"<- Chameleon ->" <ch******@hotmail.NOSPAM.com> wrote in message news:<bn**********@nic.grnet.gr>...

Thank you friend. The key-word was "Content-Range" in Google...
Because html headers does many usefull things (I see this now ;-), where can
I found a reference to all possible html headers?


Sorry, I don't know. I have 2 links for MIME
http://www.w3schools.com/media/media_mimeref.asp
http://fedb.digitalrice.com/

The second link which doesn't work now was cool. It had some
downloadable zip file.

---
"If there is a God, he must be a sadist!"
Email: rrjanbiah-at-Y!com
Jul 17 '05 #4

P: n/a
Hello,

"<- Chameleon ->" <ch******@hotmail.NOSPAM.com> wrote in message
Because html headers does many usefull things (I see this now ;-), where can I found a reference to all possible html headers?


http://www.w3.org/Protocols/rfc2616/rfc2616.txt describes most of them.

Best regards,

Eric
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.