Closed Bug 577070 Opened 14 years ago Closed 14 years ago

Add the file size to the input file

Categories

(Firefox :: General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: aquilax, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 ( .NET CLR 3.5.30729; .NET4.0E) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 ( .NET CLR 3.5.30729; .NET4.0E) It would be nice to know the file size already on the client without have to upload it on the server. I don't see any security issue by exposing this information on the client and on the other side it can be used to block the upload of large files. Today you have to upload the file to perhaps reply the user that the file size has exceed the limit. A simple javascript check would be more efficient. Reproducible: Always
Isn't this a bug for Thunderbird ? You filed it in Firefox. I think you want to tell the user how large an attachment is while still composing the message, so that a very large file would be recognized before it's sent. That looks to me a due of bug 430288, although I wouldn't do it as a tooltip, but as an extra column in the 'Attachment' panel that appears after you've selected a file (bug 360647) PS : when I currently use the 'Attach File' dialogbox, I always switch on the 'details' view, so that I can see the size even before selecting the file.
Hi Jo No I mean in firefox for the input element type file. When a user chose to "submit" also a file, with javascript is impossible to check the file size, the only way to do it is to accept the submit, and on the server check the file size and then perhaps tell the user: "sorry you have uploaded a too big file, it will be discarded". Instead it would be nicer to have a (javascript) method on the client to know the file size before the form is submitted, so you can block the submit still on the client and tell the user: "sorry the file size exceeds the limit".
You already have access to the file size in JavaScript by using the File API. There is a size attribute. See https://developer.mozilla.org/en/DOM/File for more information. Something like input.files[0].size should return the correct information.
Resolving the bug as invalid per previous comment.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.