Hey allemaal,
Ik gebruik dit script: http://www.phphulp.nl/php/scripts/7/244/
code:
<?php
$fullPath ="http://www.madpaintball.co.uk/userfiles/punjabi_lose_yourself.mp3";
if ($fd = fopen ($fullPath, "r")) {
$path_parts = pathinfo($fullPath); //ver 1.02 uses pathinfo now
$ext = strtolower($path_parts["extension"]); //ver 1.01: Added the stringconv. to handle also extensions with caps
switch ($ext) {
case "pdf":
header("Content-type: application/pdf"); // add here more headers for diff. extensions
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachement' to force a download
break;
default;
header("Content-type: application/octet-stream");
header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
}
header("Cache-control: private"); //use this to open files directly
while(!feof($fd)) {
$buffer = fread($fd, 2048);
echo $buffer;
}
}
fclose ($fd);
exit;
?>
waarom krijg ik deze error:
Warning: fopen(http://www.madpaintball.co.uk/userfiles/punjabi_lose_yourself.mp3) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\server\Apache2\htdocs\download.php on line 24
Warning: fclose(): supplied argument is not a valid stream resource in C:\server\Apache2\htdocs\download.php on line 42
1.150 views