开发者

PHP FTP transfer

I have files that are automatically uploaded onto a server from mobile phones, and I nee开发者_StackOverflow中文版d to automatically transfer these files from the server to another server using PHP.

Could someone please explain how I would do this?

Thanks for any help


PHP has FTP functionality built in with FTP wrappers:

Allows read access to existing files and creation of new files via FTP. If the server does not support passive mode ftp, the connection will fail.

This means you can use FTP like any other file - an extremely simple example:

<?php
$data = file_get_contents('some/other/file.txt');
$fname = "ftp://name:yourpassword@127.55.41.10:21/some/path/filename.txt";
file_put_contents($fname,$data);
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜