How to check the size of a file before that the server receive it?
I have a issue on uploading files:
In order to avoid an overloading of the server, I would check the size of a file before开发者_开发知识库 that the server receives it. If I am not wrong, pressing the submit button of a form which contains a file input field (<input type="file" name="...">
), the server first will entirely receive the file and after will check the file.
I'm guessing that file uploads will have a Content-Length header, in which case, you can just check that at the server end and drop the connection if it's too large.
精彩评论