View Full Version : Trying to upload through link, help.

09-08-2008, 11:52 PM
How can I modify this file upload script to get a file from www.example.com/download.zip.

//set where you want to store files
//in this example we keep file in folder upload
//$HTTP_POST_FILES['ufile']['name']; = upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path= "upload/".$HTTP_POST_FILES['ufile']['name'];
if($ufile !=none)
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
echo "Successful<BR/>";


09-10-2008, 01:05 AM
this looks like old code - $HTTP_POST_FILES hasn't been used for a long time.

also, if you're looking to pull a file from a URL, look into fopen() (http://php.net/fopen) or cURL (http://www.php.net/manual/en/book.curl.php). The code you posted is for taking a file posted by a user and uploading it to your server. I'm not clear by your post which you're trying to do.

If you're trying to do file uploads, handling file uploads (http://www.php.net/manual/en/features.file-upload.php) should have everything you need.