Re: Restricting maximum upload size

2009/7/11 John Drinkwater <>:
> 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.

Received on Saturday, 11 July 2009 13:30:28 UTC