php上传文件从服务器到另一个通过FTP? [英] php upload file from server to another via FTP?
问题描述
mysite1.com/myfile.jpgrel =nofollow> http://mysite1.com/myfile.jpg < - 我想要通过ftp复制或上传到mysite2.com
例如: http://mysite1.com/myfile.jpg上传到 http://mysite2.com/fileuploads/
如何通过PHP FTP传输来做到这一点?任何硬编码器在这里可以帮助我的问题?
这里是一个示例代码,但你应该阅读, :
$ connection = ftp_connect($ server);
$ login = ftp_login($ connection,$ ftp_user_name,$ ftp_user_pass);
if(!$ connection ||!$ login){die('Connection attempt failed!'); }
$ upload = ftp_put($ connection,$ dest,$ source,$ mode);
if(!$ upload){echo'FTP upload failed!'; }
ftp_close($ connection);
希望它帮助您入门
Hi I have a problem in transferring file from server to server I want to copy file like:
http://mysite1.com/myfile.jpg <-- I want this to copy or upload via ftp to mysite2.com
For example: http://mysite1.com/myfile.jpg upload to http://mysite2.com/fileuploads/
How to do this via PHP FTP transferring? Any hardcoder here can help my problem?
Well here's one sample code, but you should read and try on your own before asking:
$connection = ftp_connect($server); $login = ftp_login($connection, $ftp_user_name, $ftp_user_pass); if (!$connection || !$login) { die('Connection attempt failed!'); } $upload = ftp_put($connection, $dest, $source, $mode); if (!$upload) { echo 'FTP upload failed!'; } ftp_close($connection);
Hope it helps you getting started
这篇关于php上传文件从服务器到另一个通过FTP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!