Michdd Posted January 29, 2009 Share Posted January 29, 2009 I'm need to be able to copy a image from another server onto my server. Somewhat like when you use the URL submission at a image host like http://imageshack.us however when I use file_put_contents() it just gives me a broken image. Quote Link to comment https://forums.phpfreaks.com/topic/143016-file_put_contents/ Share on other sites More sharing options...
.josh Posted January 29, 2009 Share Posted January 29, 2009 depends on how you are retrieving the file. Through a form upload? Look into $_FILE and move_uploaded_file(). Grabbing it some site? Look into the GD library to create an image source out of it and save it. Quote Link to comment https://forums.phpfreaks.com/topic/143016-file_put_contents/#findComment-749941 Share on other sites More sharing options...
Michdd Posted January 29, 2009 Author Share Posted January 29, 2009 It's actually just for person use. It's using a form, but that doesn't really have anything to do with it because the form just requires a URL and a password. It's really basic. The script just plugs in the needed information and should upload the file. It's not taking it off my harddrive, it's taking it from an external site. Edit: I've used Php GD library before for other things. But for this what functions would I have to use? Quote Link to comment https://forums.phpfreaks.com/topic/143016-file_put_contents/#findComment-749951 Share on other sites More sharing options...
.josh Posted January 29, 2009 Share Posted January 29, 2009 okay well then you can try copy("http://www.somesite.com/somepic.jpg","somepic.jpg"); Quote Link to comment https://forums.phpfreaks.com/topic/143016-file_put_contents/#findComment-749962 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.