473,386 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Need "Resume Support" in forced downloding of media file

I am using the following PHP code to force the internet browser to download a media file(e.g, .mp3, .wma), But in this code, there is no resume support in downloading these files.
i dont know PHP, i am very much thankful to the person who gave me this code.
Kindly tell me, that what changings are to be needed to enable resume support in downloading.
Thankyou.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. if((array_key_exists('file', $_GET)) && ($fp = @fopen($_GET['file'], 'rb')) && (pathinfo($_GET['file'], PATHINFO_EXTENSION) != 'php'))
  4. {
  5.     header('Content-Disposition: attachment; filename="' . basename($_REQUEST['file']) . '";' );
  6.     header('Content-Transfer-Encoding: binary');
  7.     header('Content-Length: ' . filesize($_GET['file']));
  8.     fpassthru($fp);
  9. }
  10. else
  11. {
  12. ?><html>
  13.     <head>
  14.         <title>404 - File not found</title>
  15.     </head>
  16.     <body>
  17.         <div style="font-size:36px;">File not found</div>
  18.         <div style="font-size:12px;">The file you requested ('<?php echo $_GET['file'] ?>') could not be found.</div>
  19.     </body>
  20. </html><?php
  21. }
  22. ?>
  23.  
Sep 19 '07 #1
4 2010
Atli
5,058 Expert 4TB
Hi.

What do you mean by "resume"?
Are you trying to continue a half finished download?
Sep 20 '07 #2
Hi.

What do you mean by "resume"?
Are you trying to continue a half finished download?


Yes you are right,
i am using download accelerator to do download my files but it gives error message in start of downloading that "resume not supported". means if user lost his connection than it is not possible to start/resume download from the broken state. Means that if a user is downloading 3 mb file, and after 2 mb of download if user lost internet connection, or due to power failure, than the user will lost 2 mb, and user must start downlaoding from the beginning.
Actualy, when i use download.php for forced download than there is no resume supprt, but when i use normal downloading (means to right click on link and select "save target as...") than there is a resume support, but by using download.php (above given code) there is no resume support.
Kindly tell me is there any problem in the above code, or what should i do?????
Thankyou
Sep 20 '07 #3
Atli
5,058 Expert 4TB
I see.

The reason why your download accelerator can't resume the download is because there is no actuall file to download.
Your download.php is reading the file from the very beginning every time the file is requested.

Without actually knowing how the acceleration program works, I would assume that it can somehow request a portion of the file from the server, which your PHP code is unable to understand.

If you are able to find out how your application is able to request a portion of a file, you may be able to re-write your PHP script to understand it and send only the part requested.
Sep 21 '07 #4
I see.

The reason why your download accelerator can't resume the download is because there is no actuall file to download.
Your download.php is reading the file from the very beginning every time the file is requested.

Without actually knowing how the acceleration program works, I would assume that it can somehow request a portion of the file from the server, which your PHP code is unable to understand.

If you are able to find out how your application is able to request a portion of a file, you may be able to re-write your PHP script to understand it and send only the part requested.

Thanks,
i dont have any knowledge about it, will you please do it for me.
Thankyou and waiting for your reply.
Sep 22 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Adam Rogoyski | last post by:
Is there a xsl-fo renderer that supports table-layout="auto" instead of just "fixed"? Neither fop and xep support it. What products are people using for real book publishing? Adam Rogoyski
43
by: Zeng | last post by:
It's so messy w/o the "friend" relationship. Does anyone know why it was not supported in C#. It's almost about as bad as it doesn't support the inheritance hierarchy and method reference...
0
by: kjr | last post by:
In VB6 I was able to trap and error and if I wanted to ignore the error (e.g. Invalid use of null or InvalidCastException: a db column was null when reading into a variable) I could "Resume Next"...
1
by: Diffident | last post by:
Hello Guys, I have an issue with one of the EDP's (Exam Delivery Providers) for Microsoft Certification exams. Someone on this group has suggested me to open a support incident to voice my...
6
by: William | last post by:
for example, I have a global object: extern Object myobj; Can gcc get this object by using string "myobj" at runtime?? I know C++ rtti doesnt support this, but I dont know if gcc can , ...
14
by: W2K3R2admin | last post by:
I cannot open help and support...how do I install it on an existing system? When I click on Help & Support, the error says "Windows cannot open Help and Support because a system service is not...
0
by: DR | last post by:
when i build someone's project, and right click a function "goto definition" is disabled. how to reconfigure a .net project to support "goto definition" when i right click on function calls?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.