HTTP vs FTP upload

前端 未结 7 2473
攒了一身酷
攒了一身酷 2020-12-28 19:01

I am building a large website where members will be allowed to upload content (images, videos) up to 20MB of size (maybe a little less like 15MB, we haven\'t settled on a fi

相关标签:
7条回答
  • 2020-12-28 19:06

    The big advantage of HTTP is that it goes over firewalls and it's very easy to encrypt---just use HTTPS on port 443 instead of HTTP on port 80. Both go through proxies and firewalls. And these days it's pretty easy to upload a 20MB files over HTTP/HTTPS using a POST.

    The problem with HTTP is that it is not restartable for uploads. If you get 80% of the file sent and then there is a failure, you will need to restart at the beginning. That's why vendors are increasingly using flash-based, java-based or javascript-based uploaders and downloaders. These systems can see how much of the file has been sent, send a MAC to make sure that it has arrived properly, and resend the parts that are missing.

    A MAC is more important than you might think. TCP checksums are only 32 bits, so there is a 1-in-4-billion chance of an error not being detected. That potentially happens a lot with today's internet.

    0 讨论(0)
  • 2020-12-28 19:12

    Resource availability / usage is more of an issue than reliability or speed. Each upload consumes resources - thread / memory / etc - on your web server for the duration of the upload. If content upload traffic is significant for large files it would be better to use FTP simply to free your HTTP server to be more responsive to page requests.

    0 讨论(0)
  • 2020-12-28 19:14

    HTTP definitely puts less of a burden on your clients. A lot of places have proxies or firewalls that block all FTP traffic (in or out).

    0 讨论(0)
  • 2020-12-28 19:26

    Is HTTP uploading reliable enough for such large files

    One major advantage of FTP would be the ability to resume aborted uploads. Most FTP servers and clients support this, though it's not always activated. Whereas with HTTP, it's theoretically possible using special headers, but a normal client (i.e. browser) will not support it.

    Another advantage would be bulk uploads: very simple in FTP, not so in HTTP.

    But why not simply offer both options? HTTP for those who are behind proxies or won't/can't use an FTP client, and FTP for people who have to do upload many or large uploads over unreliable connections.

    0 讨论(0)
  • 2020-12-28 19:28

    I do not want to be sarcastic, but File Transfer Protocol must be more reliable on file transfer :)

    0 讨论(0)
  • 2020-12-28 19:29

    I definitely, opt for the HTTP approach as the rest of the people here. The reason for this is what you've said about most of the files being from one to three megabytes.

    The problem is for the "rest", so:

    Have you considered allowing users to send larger files through e-mail to a deamon script that gets the emails and uploads the emails to the account associated with the sender? Or there is the solution of the flash uploader, in a facebook-like approach.

    0 讨论(0)
提交回复
热议问题