15

Is it possible to resume interrupted uploads using HTTP Post? I am working on a project that uploads several files to a HTTP server. Thanks.

0pcl
  • 1,154
  • 4
  • 17
  • 22

3 Answers3

10

Assuming you have control at a low enough level on both client and server sides of this project you could achieve this via Content-Range headers in your POST (or PUT) requests that send the data.

imaginaryboy
  • 5,979
  • 1
  • 32
  • 27
  • 6
    Except that RFC 2616 does not define how to send partial content in a client request, only in a server response. If the client request had to pass through an HTTP proxy, for instance, the uploaded data may no work correctly if partially uploaded. Better to use FTP instead of HTTP for partial file transfers. – Remy Lebeau Dec 04 '09 at 02:42
  • 7
    Section 9.6 (PUT) of the RFC contains this sentence: "The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not understand or implement and MUST return a 501 (Not Implemented) response in such cases." To me that implies that a proxy would need to pass that header through, no? At any rate, the thought had occurred to be because mod_dav supports ranges in PUTs for exactly this purpose. – imaginaryboy Dec 04 '09 at 16:04
  • 1
    Thanks for the reply! I am uploading files by multipart/form-data now, can I use Content-Range header with it? I also found something called multipart/byteranges, is it something I should use for resuming uploads? – 0pcl Dec 23 '09 at 10:01
  • I'm surprised they haven't standardized some protocol for this! – sudo Aug 08 '15 at 20:49
3

Yes but it seems you have to use the HTML5 file API to slice the file into chunks: http://www.html5rocks.com/en/tutorials/file/dndfiles/#toc-slicing-files

Timmmm
  • 88,195
  • 71
  • 364
  • 509
2

well some more info would be useful

Most easy is using http://resumablejs.com which uses

"HTML5 file API to slice the file into chunks" (as Timmmm said)


just btw - FTP can do this as well, but it might be disabled E.g. in ProFTP it is disabled by default and a common error is not enabling it ;), you would need to add

AllowStoreRestart on

to your proftpd.conf

sebilasse
  • 4,278
  • 2
  • 37
  • 36