Jump to content

Force Download Script


Wolverine68

Recommended Posts

I pasted a copy of a code that someone shared on another site for forcing downloads. I tested it out for downloading mp3 files. When you click on the link for calling the php code it does prompt you and asks if you want to open or save the file. The file type shows as "mp3" however the file size says 221 bytes. I know that the file is about 20MB.

 

If I click on Save, it prompts me to save to my local hard drive. The "Save as Type" shows up, by default, as HTML document. Why would it do that? This is an mp3 file. Even if I change it to "All Files" and save it as an mp3, it doesn't play. I get an error saying it doesn't recognize the file.

 

Anyone one have a diagnosis?

 

CODE<?php

ini_set('session.cache_limiter', '');

header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');

header('Cache-Control: must-revalidate, post-check=0, pre-check=0');

header('Pragma: no-cache');

 

header("Content-Disposition: disposition-type=attachment; filename=movie.wmv");

 

readfile("http://www.remotedomain.com/movie.wmv");

<!-- the movie,mp3,mpeg file can be sitting on a remote domain and you just call to it. -->

?>

 

Code for the calling link:

CODE<html>

<head>

<title>Testing Movie Download</title>

</head>

 

<body>

 

<a href="/path/to/script.php">Download Movie[/url]

<!-- Where script.php is stored on your domain -->

 

</body>

</html>

 

Link to comment
Share on other sites

Did you not post this same thread yesterday? And did you try the script that was given to you by one of the posters here? I have used that very script that the poster posted in order to prevent that exact problem you are having.

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.