Jump to content

File Downloading


glenelkins

Recommended Posts

Im trying to download WMV files with php. The files appear to download fine but they wont open. Here is my code

[code]
// First get the video
$video = $_GET['vid'];

$file_name_tmp = explode("/",$video);
$file_name = $file_name_tmp[2];
$file_path = "http://www.lostbum.com/$file_name_tmp[1]/";

echo $file_path . $file_name;

// send the necessary headers.
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$file_name");

header("Content-transfer-encoding: binary\n");
header("Content-length: " . filesize($file_path.$file_name) . "\n");

// open the file for reading and start dumping it to the browser

$fp=fopen($file_path.$file_name, "r");
fpassthru($fp);
[/code]
Link to comment
https://forums.phpfreaks.com/topic/32004-file-downloading/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.