- From: Alfonso Martínez de Lizarrondo <amla70@gmail.com>
- Date: Sat, 11 Jul 2009 13:30:18 +0200
- To: HTML WG <public-html@w3.org>
I would like to propose adding a new attribute to <input type="file">, named (for example) maxsize, it should contain a number, the maximum size in bytes allowed by for each single file to be uploaded to the server. If it's missing, or it isn't a positive integer, it will default to 0, meaning that no file check will be done at the client side. That way it's possible to restrict the upload of big files without wasting time trying to send it to the server and get back an error message. It will be possible to do this check with Javascript with the filesize attribute of the File interface (http://dev.w3.org/2006/webapi/FileUpload/publish/FileUpload.html#dfn-filesize), but that requires Javascript to be enabled, and adding custom validation to the form. Following on that, then comes the issue of <input type="file" multiple>, instead of adding another attribute to the input element, I think that it might be better to add it to the <form>, defining the total size that can be sent as the body of the POST to the server, if the sum of files and other text data it's over the maximum allowed size the form will fail the validation and won't be submitted. This feature will be useful also if full directories upload is ever implemented as suggested in http://lists.whatwg.org/htdig.cgi/help-whatwg.org/2008-June/000134.html and as pointed in the reply, a maximum size of upload will avoid selecting too much data.
Received on Saturday, 11 July 2009 11:30:58 UTC