Page 1 of 1

PHP Upload file from URL

Posted: Sat Jan 05, 2013 9:39 am
by agurchand
Do you know only one line of code will upload a image or file from a URL?
check this out:

Code: Select all

file_put_contents("uploads/$name", file_get_contents($url);
Please give your comments about this program friends.

Re: PHP Upload file from URL

Posted: Sat Jan 05, 2013 6:27 pm
by social_experiment
technically you'd be making a copy of the file; what do you intend to use the script for?

Re: PHP Upload file from URL

Posted: Sat Jan 05, 2013 8:48 pm
by requinix
copy() would be even easier.