Recommended way to check file size on upload

前端 未结 10 801
南笙
南笙 2021-02-04 10:33

I am working on a web application which supports file uploading. I am already familiar checking the size in server side, but i wanted to check the file size in a client side.

10条回答
  •  猫巷女王i
    2021-02-04 11:13

    I believe file upload is based on RFC 1867, although HTML5 supersedes all this. You can perfectly reimplement this RFC, server side, and check the size of the cumulated incoming stream.

    In the most general cases, I don't think you can safely rely on the content-length as it may not represent the size of the file, but just the size of a chunk.

提交回复
热议问题