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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:57:18+00:00 2026-05-27T06:57:18+00:00

Possible Duplicate: jQuery : simulating a click on a <input type=“file” /> doesn't work

  • 0

Possible Duplicate:
jQuery : simulating a click on a <input type=“file” /> doesn't work in Firefox?

Is it possible to have a file button without an input beside it by default? Ideally all I want is a button that lets the user navigate to a file without showing what they selected prior to an upload. I’ll submit the form by the following after a user chooses a file:

$("#file").change(function() {
    $("#update_button").trigger('click');
});

I’m sure this must be possible with some css or jquery magic…

  • 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-27T06:57:19+00:00Added an answer on May 27, 2026 at 6:57 am

    If I remember correctly, HTML5 allows you to call the click method on a hidden input element to show the file dialog via a custom button (why not just make it work without an element, I don’t know). Unfortunately not all currently in use browsers support this yet, so you’re stuck with styling a file input to look like a button.

    This is a hilariously ugly but ingenious CSS hack I came across on a site once (probably imgur):

    .fileupload {
        width: 100px;
        height: 50px;
        position: relative;
        overflow: hidden;
        background: ...; /* and other things to make it pretty */
    }
    
    .fileupload input {
        position: absolute;
        top: 0;
        right: 0; /* not left, because only the right part of the input seems to
                     be clickable in some browser I can't remember */
        cursor: pointer;
        opacity: 0.0;
        filter: alpha(opacity=0); /* and all the other old opacity stuff you
                                     want to support */
        font-size: 300px; /* wtf, but apparently the most reliable way to make
                             a large part of the input clickable in most browsers */
        height: 200px;
    }
    

    And the HTML to go with it:

    <div class="fileupload">
      <input type="file" />
      Any content here, perhaps button text
    </div>
    

    What it does is it makes the file input itself enormous (by changing the font size (!?)) to ensure it covers the button, and then cuts off the excess with overflow: hidden;. This may not work for absolutely enormous buttons.

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

Sidebar

Related Questions

Possible Duplicate: jQuery: get the file name selected from <input type=file /> I have
Possible Duplicate: In jquery: Use attr(“class”) value as a selector? I have fields with
Possible Duplicate: jquery trigger - ‘change’ function I have a radio button set called
Possible Duplicate: jQuery bind click ANYTHING but ELEMENT I have this HTML <div id=outer>
Possible Duplicate: jQuery Ajax always returns “undefined”? I'm trying to come up with a
Possible Duplicate: jQuery multiple class selector I have an input field '#q' where a
Possible Duplicate: jQuery change input type How to replace input[type=submit] to input[type=text] using jQuery?
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have
Possible Duplicate: jquery/ajax load new content when available i have a table named news
Possible Duplicate: jQuery get input value after keypress I'm trying to get an input

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.