Re: Restricting maximum upload size

2009/7/16 Charles McCathieNevile <chaals@opera.com>:
> On Sat, 11 Jul 2009 15:29:53 +0200, Alfonso Martínez de Lizarrondo
> <amla70@gmail.com> wrote:
>
>> 2009/7/11 John Drinkwater <john@nextraweb.com>:
>>>
>>> Alfonso Martínez de Lizarrondo wrote:
>>>>
>>>> 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.
>>>
>>>> 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.
>>>
>>> Or the attribute maxsize would apply per file, so the total permitted
>>> would
>>> be maxsize × quantity of files selected. Would that fit better?
>>>
>>
>> The maxsize in the <input> would apply to each file, that's what you
>> describe. But the overall maximum size of the upload might be
>> different, so it needs a way to restrict it.
>>
>> The developer might state that each uploaded file must be a maximum of
>> 5Mb, and at the same time he wants to allow to upload up to 20 files
>> at a time, but he knows that the server is configured so it only
>> accepts 20Mb in each POST, so you can upload 4 files of 5Mb each, or
>> 20 files of 1Mb each (and every other possible combination).
>>
>> In the <form> the maxsize would be mostly the maximum upload size
>> allowed by the server, and the restriction of maxsize for each
>> individual file would be a preference of the site.
>>
>> I think that it covers any combination that way.
>
> There is work in the Web Apps working group on file upload and file apis -
> it would be valuable to forward this suggestion to the relevant list.
>
> File Upload draft:
> http://dev.w3.org/2006/webapi/FileUpload/publish/FileAPI.xhtml
> File I/O will move to device API group but there is an old draft at
> http://dev.w3.org/2006/webapi/fileio/fileIO.htm which is an Opera submission
> to the old webAPI group on the topic (there are various flavours of this
> around now...).
>
> cheers
>
> Chaals
>
> --
> Charles McCathieNevile  Opera Software, Standards Group
>      je parle français -- hablo español -- jeg lærer norsk
> http://my.opera.com/chaals       Try Opera: http://www.opera.com
>

I don't think that this proposal should be handled by other groups.
I'm not talking about javascript or new APIs, just to add an attribute
to the <file type="input"> and <form> elements to automatically limit
it's maximum data, just like <input type="text"> and <textarea> have
the maxlength: http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#attr-input-maxlength
and http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#attr-textarea-maxlength

I know that I must send other ideas to the Web Apps groups, but I
really thought that this one should be defined here.

Received on Tuesday, 21 July 2009 20:58:57 UTC