Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8051379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:17:26+00:00 2026-06-05T07:17:26+00:00

I figure I’d demonstrate the problem with an example first, jsfiddle: http://jsfiddle.net/e2UfM/15/ (Tested with

  • 0

I figure I’d demonstrate the problem with an example first,

jsfiddle: http://jsfiddle.net/e2UfM/15/
(Tested with FF 12, and Chrome 18.0.1025.168)

Usage:

  • Load in a text file from your local machine.
  • Hit “load file”.
  • Hit “display file size” – note the size.
  • modify & save the text file on your local machine.
  • Hit “display file size” again. Note how in webkit browsers (Chrome) the file size changes, but in Firefox it didn’t update the file size

Non-webkit browsers do not update their size attribute when users make changes to the local file that they have selected whereas Chrome for example does. Both browsers update the contents of the file.

Is there a way to get Firefox to update the file size similar to how Chrome does in this situation?


Simple Real World Example:

User selects a file that’s too large for the form, they hit the submit button and get notified that their file is too large (via an alert, “size” bar (see below), etc)

They modify the file locally, and hit submit again.

In Chrome, the file size updates. When the user hits the submit button again, it will validate it’s updated size once more and allow the upload. In Firefox, the user must re-select the file on the form before it will see the file size change.

A partial workaround for Firefox – @ZER0’s answer


Real world example (in-depth):

One purpose of the File API is to verify file sizes on the client side before uploading to a server if I’m not mistaken.

Consider the scenario where there is a 2MB upload limit in a form and the user chooses a 1MB file. Both Firefox and Chrome will see that the file size is less than 2MB and add it to the form. Let’s also say there is a neat bar that shows how big of a file they have chosen, and if it meats the file size limit or not:

The 1MB file that the user has chosen!

But then the user decides to make a minor change to the contents of that file locally before they submit the form and bump the size over 2MB.

In Google Chrome, I can handle this gracefully on the client side. I can check the file size again when the user submits the form, and verify that it is still in fact under 1MB before sending it to the server. But even before the user submits the form, in Chrome, I can go as far as updating the little bar image dynamically as they make changes locally as such:

Now the file is over 2MB, bad!

This “bar” (or any other form on instant notification such as an alert) is useful if the user is filling out a large form. I’d like the user to know instantly when their file is too large and so that they can correct it then, and not just when they submit the form.

In Firefox, because the file size never updates, it will gladly upload the 2MB file thinking that it is still 1MB! I use server side logic to double check the file size, but I’d rather save a server trip.


How I came across the bug:

The above examples are in place to relate to more people as more people have probably dealt with file uploads in forms vs. using the slice function in the File API. This is specifically how I am running into the issue.

In my form, the user selects a file and when they hit submit only the last 10,000 bytes are displayed on the screen in a textarea to confirm that it’s really the file that they want.

Consider a file with a size of 50,000 bytes. A user chooses it in the form, and both Chrome and Firefox show bytes 40,000 - 50,000 in the textarea.

Now the user adds some content to the file, and bumps the same file to 70,000 bytes!

Google Chrome will properly update the textarea to contain bytes 60,000-70,000. In Firefox, because the size will remain constant, it will still only show bytes in the range 40,000-50,000.


Edit: Updated the jsfiddle to demonstrate that FF can still read the updated file contents. It’s just that the file size does not change with those new contents.

Edit: https://bugzilla.mozilla.org/show_bug.cgi?id=756503 (bug report)

Edit: Examples have been added & updated in response to @Eduárd Moldován’s comment & @ZER0’s answer. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:17:28+00:00Added an answer on June 5, 2026 at 7:17 am

    It seems that you’re get the size property from the directly, and because the value in this form element is not changed it’s likely that Firefox doesn’t update the size property as well.

    As workaround, you can check the length of the content you have read. So instead of file.size have evt.target.result.length.

    However, it’s definitely a bug to me so you have done well to add it on Bugzilla!

    Update:
    You can still use the string version of slice. Otherwise, if you prefer (or the result is a particular type of data), you can create from evt.target.result a new Blob object (The File Object use this interface) where you can use both size property and slice method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Figure there is a simple solution to this problem but I have been unable
Cant figure out what the problem is! $msgs = mysql_num_rows(mysql_query(SELECT * FROM messages WHERE
I figure this problem is easier than just a regular spell checker since the
I'm trying to figure out why the control does not honor ZIndex. Example 1
I figure I should use 'Aggregate' but apparently I am getting it wrong First
figure; plot(trainingSet(:, 1), trainingSet(:, 2), '*'); figure; plot(reprVectors(:, 1), reprVectors(:, 2), '*'); How do
This figure again shows that every object has a prototype. Constructor function Foo also
Cannot figure out, where to change EOF in PyCharm. My scripts start with :
I am trying to figure out something. I have a method which adds some
I'm trying to figure out if its possible to loop a foreach loop in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.