How does the code write the image stored in PHP to the server?
PHP files on the server;
The picture URL is known;
Reply content:
How does the code write the image stored in PHP to the server?
PHP files on the server;
The picture URL is known;
The idea is to get the picture in the PHP code first and then store it locally on the server.
The code can be organized like this:
$url = 'http://pic22.nipic.com/20120627/7947919_114513420170_2.jpg';$img = '/tmp/bear.jpg';$pic = file_get_contents($url);file_put_contents($img, $pic);
You can also use curl, and then set CURLOPT_FILE
the property to a local file.
A thought, download the URL address of the picture to local, and then upload to the remote server.
Direct copy
Usually when writing PHP, the image upload is the client's local file address, local address to a known URL address, write a script to upload directly