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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:13:45+00:00 2026-05-29T05:13:45+00:00

I am trying to style up my input:file. The following SO question gets me

  • 0

I am trying to style up my input:file. The following SO question gets me 95% of the way there. The difference is that I am using the HTML5 multiple=multiple attribute.

How to style "input file" with CSS3 / Javascript?

JS

        $('#choose-files-button').click(function () {
            $(':file').trigger('click');
        });

        $(':file').change(function () {
            $this = $(this);
            $('#files-selected').text($this.val());
        })

Html

    @using (Html.BeginForm("Upload", "Manage", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
        <span id="choose-files-button" class="btn btn-info">Choose Files</span>
        <span id="files-selected"></span>
        <button class="pull-right btn btn-primary" type="submit">Upload</button>
        <div style="height:0; width:0;overflow:hidden;">
            <input type="file" name="files" id="files" multiple="multiple" value="Add Images" />
        </div>
    }

The Problem

The problem is that when the text of files-selected gets set it only shows one file name in Chrome. I haven’t tested other browsers yet. It sets it to something like C:/Fakepath/asfd.jpg.When you just use the <input type="file" name="files" multiple="multiple" /> it says something like 3 files selected, which is the behavior I am trying to emulate.

Is there a way to get to that text, or get the number of files selected?

  • 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-05-29T05:13:46+00:00Added an answer on May 29, 2026 at 5:13 am

    Use this.files.length where this is the file DOM element.

    $(':file').change(function () {
        $('#files-selected').text(this.files.length + " file selected");
    });
    

    Demo

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

Sidebar

Related Questions

I'm trying to style input type:file. Problem I've encountered is that in Firefox I
I'm trying to achieve ajax-like-file-upload-using-hidden-iframe . Obviously there are many plugins available for that
I'm trying to style a button using <input type=button> instead of just <button> .
I am trying to create a C-style DLL interface that takes in an input
Possible Duplicate: Styling <input type=file> Style input type file? I`m trying to change a
Possible Duplicate: Styling an input type=file button I was trying to style <input type=file>
I'm trying to style my file input, so i ended up having an extra
I'm trying to style a TreeView using this example and everything was working fine
I'm trying to style a select option list using CSS. I want more padding
I'm trying to style all <select> elements that are a descendant of a <div>

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.