有什么方法可以使用 Perl CGI 脚本恢复失败的上传吗?

发布于 2024-09-04 05:23:13 字数 139 浏览 0 评论 0原文

该应用程序很简单,是一个发布到 Perl 脚本的 HTML 表单。问题是我们有时会让客户上传非常大的文件(> 500mb),而他们的互联网连接有时可能不可靠。

有没有办法像 WinSCP 一样恢复失败的传输,或者如果客户端不支持它就无法完成?

The application is simple, an HTML form that posts to a Perl script. The problem is we sometimes have our customers upload very large files (gt 500mb) and their internet connections can be unreliable at times.

Is there any way to resume a failed transfer like in WinSCP or is this something that can't be done without support for it in the client?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烟火散人牵绊 2024-09-11 05:23:13

AFAIK,它必须得到客户端的支持。基本上,客户端和服务器需要协商文件的哪些部分(可能定义为“multipart/form-data”POST 中的部分)已经上传,然后服务器代码需要能够将新上传的数据与现有的一个。

最好的解决方案是使用自定义上传器代码,通常用 Java 实现,尽管我认为这在 Flash 中也可能实现。您甚至可以通过 JavaScript 来完成此操作 - 请参阅下面的 2 个部分和示例


以下是 Google 如何使用 YouTube 实现此目的的示例:http://code.google.com/apis/youtube/2.0/developers_guide_protocol_resumable_uploads.html

它使用“308 Resume Incomplete”HTTP 响应,发送 range: bytes =0-408 来自服务器的标头,用于指示已上传的内容。


有关该主题的其他想法:

  1. http://code.google.com/ p/gears/wiki/ResumableHttpRequestsProposal

  2. 有人在客户端使用 Google Gears 并在服务器端使用 PHP 实现了这一点(后者可以轻松移植到 Perl)

    http://michaelshadle。 com/2008/11/26/updates-on-the-http-file-upload-front/

    http: //michaelshadle.com/2008/12/03/updates-on-the-http-file-upload-front-part-2/

AFAIK, it must be supported by the client. Basically, the client and the server need to negotiate which parts of the file (likely defined as parts in "multipart/form-data" POST) have already been uploaded, and then the server code needs to be able to merge newly uploaded data with existing one.

The best solution is to have custom uploader code, usually implemented in Java though I think this may be possible in Flash as well. You might be even able to do this via JavaScript - see 2 sections with examples below


Here's an example of how Google did it with YouTube: http://code.google.com/apis/youtube/2.0/developers_guide_protocol_resumable_uploads.html

It uses "308 Resume Incomplete" HTTP response which sends range: bytes=0-408 header from the server to indicate what was already uploaded.


For additional ideas on the topic:

  1. http://code.google.com/p/gears/wiki/ResumableHttpRequestsProposal

  2. Someone implemented this using Google Gears on calient side and PHP on server side (the latter you can easily port to Perl)

    http://michaelshadle.com/2008/11/26/updates-on-the-http-file-upload-front/

    http://michaelshadle.com/2008/12/03/updates-on-the-http-file-upload-front-part-2/

说好的呢 2024-09-11 05:23:13

遗憾的是您的客户端无法使用 ftp 上传,因为这已经包含了类似的功能。 HTTP 中还有“分块传输编码”。我不知道哪些 Perl 模块可能已经支持它。

It's a shame that your clients can't use ftp uploading, since this already includes abilities like that. There is also "chunked transfer encoding" in HTTP. I don't know what Perl modules might support it already.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文