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 9148245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:13:20+00:00 2026-06-17T11:13:20+00:00

I have some file requirement conditions which work fine with single file select but

  • 0

I have some file requirement conditions which work fine with single file select but when using multiple file select it only counts the first file. I need it to determine the total sum of bites of all selected files and that all selected files have the accepted file extension. does anyone know how I can edit these conditions?

var file = document.getElementById('file'); 
var ext = file.value.substring(file.value.lastIndexOf('.') + 1);

   if(ext!== "mp4" && ext!== "m4v" && ext!== "fv4"){
       alert('not an accepted file extension');
         return false;
} else

   if (file.files[0].size >= 11000000) {
       alert("File too Big");
          return false; 
}

  <input name="uploaded[]"  id="file" type="file" multiple />
  • 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-17T11:13:21+00:00Added an answer on June 17, 2026 at 11:13 am

    You can map the .files to their sizes, and then add those sizes: http://jsfiddle.net/83F7B/.

    var sizes = [].map.call(this.files, function(v) {
      return v.size;
    });
    
    var totalSize = sizes.reduce(function(a, b) {
      return a + b;
    }, 0);
    

    You can also loop over the .files with forEach and check the extension of each file (or use .every).

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

Sidebar

Related Questions

I have some images and pdf file on my server which I use in
I have a requirement. I have some files in a folder among which some
I have a requirement in which I have to check whether any file exists
We have a large C# application which is deployed using an .MSI file which
I have an app in which some data file will be created. The app
Now there is a new requirement. I have got some adhoc work at hand.
I have legacy class that writes some results to a file using StreamWriter ,
i have xml file which contains some details i want to pick some value
I have a VC++ application and in my application i have some basic file
I have some values in a configuration file (XML file) with some values like

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.