How to write this php program for uploading pictures? Solve it!

for example, I have two online servers as follows:

1.web server environment centos+nginx+php+mysql, upload picture program on this server
2. Picture server environment centos+nginx

I would like to write a php upload picture program on the web server and upload it to the picture server (that is, upload the picture from the php of the a server to the b server directory). I have not done it. Please tell me about it. Thank you!

Jul.08,2022

do you mean that there is a server for pictures (called A), and then you have a program to use on another server (called B), and the pictures uploaded by B are put on server A?
in fact, I think why not just buy a cloud image server? So when you click upload image, ajax directly to that server.
but you can also build it yourself. The
method is to upload the picture to the A server by ajax.
can refer to https://blog.csdn.net/anphper...
https://blog.csdn.net/qyp_slw...

when uploading to A server, the domain name should be the same domain name. There may be cross-domain names. You can upload this in jsonp format.

do you have any questions to follow up?


http://www.runoob.com/php/php...


you can use the ftp function in php.


a server can use http protocol to assemble body body and send it to b server
, b server can receive Boy body, and then write to file

$ = file_get_contents("php://input");
Menu