i have this code working perfect to allow users to download songs from my web site, 
but the  download.php must be in same folder with any song to be downloaded.

but i have songs on another server, so i can't make the file name full path like this:

http://myserver.com/son1.mp3

 

any help plz !!!!!!!!!

<?php 

$shortname = basename( $filename ); 

if( file_exists( $filename ) // sanity check 

&& !eregi( "p?html?", $filename ) // security check 

&& !eregi( "inc", $filename ) 

&& !eregi( "php3?", $filename ) ){ 

$size = filesize( $filename ); 

header("Content-Type: application/save"); 

header("Content-Length: $size"); 

header("Content-Disposition: attachment; filename=$shortname"); 

header("Content-Transfer-Encoding: binary"); 

$fh = fopen("$filename", "r"); 

fpassthru($fh); 

exit; 

} 

else

{ 

?> 

file doesn't exsist

<?

}

?>



---------------------------------
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

Reply via email to