Saving an image onto my server form another location.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dave_c00
Forum Commoner
Posts: 37
Joined: Wed May 28, 2003 6:08 am

Saving an image onto my server form another location.

Post 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
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post 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
dave_c00
Forum Commoner
Posts: 37
Joined: Wed May 28, 2003 6:08 am

Post by dave_c00 »

Unfortunately i have an eariler version of php on my server. Is there another way?

Thanks

Dave
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

you can try file() or fopen()
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

might need fsockopen() or curl.. what version of php are you using?
Post Reply