You want to get some file from another server by using http fopen wraper? Then please note, that some functions, e.g. file_exists(), filesize() don't work across http.

fr r wrote:
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).


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to