Page 1 of 1

Saving an image onto my server form another location.

Posted: Tue Jan 10, 2006 4:14 am
by dave_c00
I was wondering if it is possible on a form to click a submit button and save an image from the location entered in an input box (e.g http://www.test.com/image1.jpg) to a known server.?? All this at a click of a button rather than having to save it locally first.

Thanks

Dave

Posted: Tue Jan 10, 2006 4:21 am
by Jenk
have you tried:

Code: Select all

$file = file_get_contents('http://www.test.com/test.jpg');
?

http://us3.php.net/manual/en/function.f ... ntents.php

Posted: Tue Jan 10, 2006 4:41 am
by dave_c00
Unfortunately i have an eariler version of php on my server. Is there another way?

Thanks

Dave

Posted: Tue Jan 10, 2006 5:32 am
by Jenk
you can try file() or fopen()

Posted: Tue Jan 10, 2006 9:07 am
by feyd
might need fsockopen() or curl.. what version of php are you using?