使用PHP流式传输FTP块? [英] Stream FTP upload in chunks with PHP?

查看:243
本文介绍了使用PHP流式传输FTP块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用PHP流式传输FTP?我有需要上传到另一台服务器的文件,我只能通过FTP访问该服务器。不幸的是,我无法在这台服务器上达到超时时间。基本上,如果有一种方法来编写文件的一部分,然后附加下一部分(和重复),而不是一次上传整件事情,这会救我。然而,我的谷歌搜索没有给我提供答案。



这是否可以实现?

解决方案

好的,这可能是你要找的。您是否熟悉curl?



CURL可以支持FTP追加:

curl_setopt($ ch,CURLOPT_FTPAPPEND, TRUE); //附加标记



另一个选项是使用ftp:// / ftps:// streams,因为它们允许附加PHP 5。请参阅ftp://; ftps://文档。可能更容易访问。


Is it possible to stream an FTP upload with PHP? I have files I need to upload to another server, and I can only access that server through FTP. Unfortunately, I can't up the timeout time on this server. Is it at all possible to do this?

Basically, if there is a way to write part of a file, and then append the next part (and repeat) instead of uploading the whole thing at once, that'd save me. However, my Googling hasn't provided me with an answer.

Is this achievable?

解决方案

OK then... This might be what you're looking for. Are you familiar with curl?

CURL can support appending for FTP:

curl_setopt($ch, CURLOPT_FTPAPPEND, TRUE ); // APPEND FLAG

The other option is to use ftp:// / ftps:// streams, since PHP 5 they allow appending. See ftp://; ftps:// Docs. Might be easier to access.

这篇关于使用PHP流式传输FTP块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆