Jump to content

Need "Resume Support" in forced downloding of media file


IRFAN12

Recommended Posts

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

}

?>

 

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.