Return to Snippet

Revision: 7739
at March 12, 2009 12:43 by benphelps


Updated Code
<?
// DOWNLOAD REMOTE FILE
// this is a-lot more complicated than it looks
// $url is the url of the file, must have fopen wrappers enabled
// $dir is the directory to save the file to relative to the current working directory
// file is saved with the same file name from its source
function getfile($url, $dir){
file_put_contents($dir.substr($url,strrpos($url,'/'),strlen($url)), file_get_contents($url));
}
?>

Revision: 7738
at August 10, 2008 16:05 by benphelps


Updated Code
<?
// IMAGE DOWNLOAD AND CREATE THUMB FUNCTION
// this is a-lot more complicated than it looks
// $url is the url of the file, must have fopen wrappers enabled
// $dir is the directory to save the file to relative to the current working directory
// file is saved with the same file name from its source
function getfile($url, $dir){
file_put_contents($dir.substr($url,strrpos($url,'/'),strlen($url)), file_get_contents($url));
}
?>

Revision: 7737
at August 10, 2008 16:04 by benphelps


Updated Code
<?
// IMAGE DOWNLOAD AND CREATE THUMB FUNCTION
// this is a-lot more complicated than it looks
// $url is the url of the file, must have fopen wrappers enabled
// $dir is the directory to save the file to relative to the current working directory
function getfile($url, $dir){
file_put_contents($dir.substr($url,strrpos($url,'/'),strlen($url)), file_get_contents($url));
}
?>

Revision: 7736
at August 10, 2008 16:01 by benphelps


Initial Code
<?
// IMAGE DOWNLOAD AND CREATE THUMB FUNCTION
// this is alot more complicated than it looks
function getfile($url, $dir){
file_put_contents($dir.substr($url,strrpos($url,'/'),strlen($url)), file_get_contents($url));
}
?>

Initial URL
http://phelps.impactwow.com

Initial Description


Initial Title
Download file from URL

Initial Tags
url, php, file, download

Initial Language
PHP