coops
12-09-2005, 07:51 AM
Hello, within a part of my website I am having a download section, I am using the following code to download my files
<?php
$loc = $_GET['loc'];
$pid = $_GET['pid'];
$name = $_GET['name'];
$file_contents = file_get_contents($loc);
/* NOW write out the requested file.*/
header("Content-type: audio/x-mpeg"); /* or whatever type */
header("Content-Disposition: attachment; filename=" . $loc);
header("Content-Length: " . $filesize);
header("Content-Transfer-Encoding: binary\n\n");
header("Pragma: no-cache");
header("Expires: 0");
print($file_contents);
?>
This works if the files that I want to download are in the same file, but if i want the files to be outside the same file placing the correct file path I get this error;
Warning: file_get_contents(e:/songs/bonjovi/bonjovi/burningforlove.mp3): failed to open stream: No such file or directory in E:\bondjovi\bondjovi\pages\dodownload.php
(There is a file path and name are correct)
Is there any one that could help as I don't want to palce all the files within one file
<?php
$loc = $_GET['loc'];
$pid = $_GET['pid'];
$name = $_GET['name'];
$file_contents = file_get_contents($loc);
/* NOW write out the requested file.*/
header("Content-type: audio/x-mpeg"); /* or whatever type */
header("Content-Disposition: attachment; filename=" . $loc);
header("Content-Length: " . $filesize);
header("Content-Transfer-Encoding: binary\n\n");
header("Pragma: no-cache");
header("Expires: 0");
print($file_contents);
?>
This works if the files that I want to download are in the same file, but if i want the files to be outside the same file placing the correct file path I get this error;
Warning: file_get_contents(e:/songs/bonjovi/bonjovi/burningforlove.mp3): failed to open stream: No such file or directory in E:\bondjovi\bondjovi\pages\dodownload.php
(There is a file path and name are correct)
Is there any one that could help as I don't want to palce all the files within one file
