文件上传有中断
我想将大文件上传到我的服务器,但我希望能够在上传过程中进行中断(例如,用户必须能够关闭其计算机并在重新启动后继续)。
我认为我可以处理客户端上传,但我不知道如何处理服务器端。在服务器端实现它的最佳方法是什么? PHP 能做到吗? PHP 是最高效的吗?
多谢
I'd like to upload large files to my server, but i would like to be able to make breaks (for example, the user must be able to shut down his computer and to continue after reboot) in the upload process.
I think i can handle the client side upload, but I don't know how to make the server side. What is the best way to make it on the server side? Is PHP able to do that ? Is PHP the most efficient?
Thanks a lot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您设法在客户端将文件分块发布,则可以在服务器端执行类似的操作:
If you manage to do the client side do post the file in chunks, you could do something like this on the server side:
如果您正在尝试设计一个网络界面以允许任何人上传大文件并部分恢复上传,尽管我不知道如何帮助您。但是,如果您只想以可恢复的方式将文件从计算机传输到服务器,则可以使用 rsync 等工具。 Rsync 比较源和目标上的文件,然后仅复制两者之间的差异。这样,如果您上传到服务器的 50 GB 文件然后更改了其中一个,rsync 将非常快速地检查所有其他文件是否相同,然后仅发送您更改的一个文件。这也意味着,如果传输在过程中中断,rsync 将从中断处继续。
传统上,rsync 是从命令行(终端)运行的,并且默认安装在大多数 Linux 和 Mac OS X 上。
这会将所有文件从 /home/user/data 传输到服务器上的 src/data 。如果您随后更改了 /home/user/data 中的任何文件,您可以再次运行该命令来重新同步它。
如果您使用 Windows,最简单的解决方案可能是使用 DeltaCopy,它是一个围绕 rsync 的 GUI。下载
If you are trying to design a web interface to allow anyone to upload a large file and resume the upload part way though I don't know how to help you. But if all you want to do is get files from you computer to a server in a resume-able fashion you may be able to use a tool like
rsync
. Rsync compare the files on the source and destination, and then only copies the differences between the two. This way if you have 50 GB of files that you upload to your server and then change one, rsync will very quickly check that all the other files are the same, and then only send your one changed file. This also means that if a transfer is interrupted part way through rsync will pick up where it left off.Traditionally rsync is run from the command line (terminal) and it is installed by default on most Linux and Mac OS X.
This would transfer all files from /home/user/data to the src/data on the server. If you then change any file in /home/user/data you can run the command again to resync it.
If you use windows the easiest solution is probably use DeltaCopy which is a GUI around rsync.download