This article mainly introduces PHP based on the implementation of the FTP file transfer files, interested in the friend's reference, I hope to be helpful to everyone.
Specific as follows:
<?phpfunction upload ($dir, $src, $dest) { $ch = Curl_init (); $fp = fopen ($src, ' R '); curl_setopt ($ch, Curlopt_url, ' ftp://user:pwd@host/interpretation/'. $dir. ' /'. $dest); curl_setopt ($ch, curlopt_upload, 1); curl_setopt ($ch, Curlopt_infile, $fp); curl_setopt ($ch, Curlopt_infilesize, FileSize ($SRC)); Curl_exec ($ch); $error _no = Curl_errno ($ch); Curl_close ($ch); if ($error _no! = 0) { return 0; } else{ return 1;} } upload ("Images", "s.py", "aaa.py"); >
Summary : The above is the entire content of this article, I hope to be able to help you learn.
Related recommendations:
The method of PHP combined with session operation database
How PHP will localize remote images
How PHP accepts files and obtains suffix names