note 30492 rejected from ref.filesystem by betz

From: Date: Thu, 20 Mar 2003 13:44:31 +0000
Subject: note 30492 rejected from ref.filesystem by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-45547@lists.php.net to get a copy of this message
This should copy a file from a URL to the server. It doesn't work. Who knows what's wrong? function CopyFileFromURL($URL){ $fp = fopen($URL, "rb"); $filecont = fread ($fp, filesize($URL)); fclose($fp); $tmpfname = tempnam("/tmp", "tmp"); $temp = fopen($tmpfname, "wb"); fwrite($temp, $filecont); fclose($temp); $URL = "files/".substr(strrchr($URL,"/"),1); if(!copy(realpath(dirname($tmpfname)."/".basename($tmpfname)), realpath($URL))) echo "Error"; unlink($tmpfname); } CopyFileFromURL("http://www.site.com/file.ext";);

« previous php.notes (#45547) next »