IRFAN12 Posted September 19, 2007 Share Posted September 19, 2007 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. I am using linux webserver. Thankyou. Code: ( php ) <?php if((array_key_exists('file', $_GET)) && ($fp = @fopen($_GET['file'], 'rb')) && (pathinfo($_GET['file'], PATHINFO_EXTENSION) != 'php')) { header('Content-Disposition: attachment; filename="' . basename($_REQUEST['file']) . '";' ); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($_GET['file'])); fpassthru($fp); } else { ?><html> <head> <title>404 - File not found</title> </head> <body> <div style="font-size:36px;">File not found</div> <div style="font-size:12px;">The file you requested ('<?php echo $_GET['file'] ?>') could not be found.</div> </body> </html><?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/69962-need-resume-support-in-forced-downloding-of-media-file/ Share on other sites More sharing options...
cooldude832 Posted September 19, 2007 Share Posted September 19, 2007 resume suppport? Php has nothing to do with the file once it is delivered to the browse (Headers sent) so you can't half download a file and have php know Quote Link to comment https://forums.phpfreaks.com/topic/69962-need-resume-support-in-forced-downloding-of-media-file/#findComment-351450 Share on other sites More sharing options...
d22552000 Posted September 19, 2007 Share Posted September 19, 2007 the headers sent to the server request a certain position of the file, do a headers() to find out what the browser asks you and tell us what you see. it should say something like: Resume: 654988 Bytes; haha good luck there! Quote Link to comment https://forums.phpfreaks.com/topic/69962-need-resume-support-in-forced-downloding-of-media-file/#findComment-351453 Share on other sites More sharing options...
cooldude832 Posted September 19, 2007 Share Posted September 19, 2007 which you won't be able to set unless some how you can get JS to set a cookie/ajax if the download is integrated into the browser some how. U can say that, the question is what is X in X bytes. X is undefined and impossible to realistically define without the anticipation of file corruption. Quote Link to comment https://forums.phpfreaks.com/topic/69962-need-resume-support-in-forced-downloding-of-media-file/#findComment-351454 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.