W3C home > Mailing lists > Public > public-html@w3.org > July 2009

Re: Restricting maximum upload size

From: Charles McCathieNevile <chaals@opera.com>
Date: Thu, 16 Jul 2009 17:18:59 +0200
Cc: "HTML WG" <public-html@w3.org>
To: Alfonso Martínez de Lizarrondo <amla70@gmail.com>, "John Drinkwater" <john@nextraweb.com>
Message-ID: <op.uw515xi0wxe0ny@widsith.local>
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
Received on Thursday, 16 July 2009 15:19:46 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:48 UTC