Беркут Posted June 17, 2011 Report Share Posted June 17, 2011 Привет! Хочу загружать себе на сервак картинки по URL'ам этих картинок..Пробовал через: move_uploaded_file($url, $upload_dir.$file_name);Не получается, как еще можно загрузить? Quote Link to comment Share on other sites More sharing options...
0 stars Posted June 17, 2011 Report Share Posted June 17, 2011 $pic = file_get_contents("http://www.site.ru/img.jpg");file_put_contents("pic.jpg", $pic); Quote Link to comment Share on other sites More sharing options...
0 LunatiK Posted June 17, 2011 Report Share Posted June 17, 2011 (edited) file_get_contents()file_put_contents()Опоздал Edited June 17, 2011 by LunatiK Quote Link to comment Share on other sites More sharing options...
0 Беркут Posted June 17, 2011 Author Report Share Posted June 17, 2011 (edited) $pic = file_get_contents("http://www.site.ru/img.jpg");file_put_contents("pic.jpg", $pic); Спасибо! Edited June 17, 2011 by Беркут Quote Link to comment Share on other sites More sharing options...
0 Veseloff Posted June 17, 2011 Report Share Posted June 17, 2011 Вы чё? Проще так, наверное:copy('http://example.com/some.jpg', '/server/some/dir/image.jpg'); Quote Link to comment Share on other sites More sharing options...
0 LunatiK Posted June 18, 2011 Report Share Posted June 18, 2011 Вы чё? Проще так, наверное:copy('http://example.com/some.jpg', '/server/some/dir/image.jpg');Как-то в голову не пришло, что там может быть урл Интересно, в документации написано что оба параметра могут быть урлами, это наверно для адреса назначения имелось ввиду что ftp ? Quote Link to comment Share on other sites More sharing options...
Question
Беркут
Привет!
Хочу загружать себе на сервак картинки по URL'ам этих картинок..
Пробовал через: move_uploaded_file($url, $upload_dir.$file_name);
Не получается, как еще можно загрузить?
Link to comment
Share on other sites
5 answers to this question
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.
Note: Your post will require moderator approval before it will be visible.