Reputation: 15976
I have some pictures that are online, the images are simple http://domain.com/pic.jpg for example; there's an upload feature but that's for user upload the user won't upload, it's an auto upload. This mean I have the Urls on an array and I want that php auto upload those Urls photo into the server Any help!! Thanks
Upvotes: 0
Views: 1741
Reputation: 192
define('IMAGE_PATH', '/path/to/images');
foreach ($urlArray as $url) {
file_put_contents(IMAGE_PATH . "/" . basename($url), file_get_contents($url));
}
This would require that the user Apache is running under has write access to the IMAGE_PATH. Also, this might not be the exact solution in your case. You seem to be in need of a database to store these filenames, which then probably should be wearing ids instead of their original filenames.
Upvotes: 5