Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML input type=“file” in Google Chrome not showing popup window

I'm having a problem with the HTML tag <input type="file" /> in Google Chrome.

The 'Browse' button appears on the page as expected, but when I click it in order to select a file, the pop-up dialog window from the browser doesn't open at all.

I 've tested my form and in Firefox and works correct. Any ideas what's wrong and how can I fix it ?

Here is also the code:

<form action="" method="post" accept-charset="utf-8" enctype="multipart/form-data">
<label for="imgfile">File input</label>
<input type="file" name="imgfile" />
like image 921
ltdev Avatar asked Mar 07 '14 08:03

ltdev


5 Answers

This happened to me on Chrome v88.0, and I tried everything -- removing all the event handlers, making the simplest form possible, removing all other html and js from the page -- and still the file-selection dialog would not appear when clicking the "Choose File" button.

Then I shut down Chrome and re-opened it ... and it worked again.

Golden advice:

Have you tried turning it off and on again?

like image 116
Luke Avatar answered Nov 05 '22 09:11

Luke


In my case the problem was as follows :

  1. Whole document had a "on click handler"
  2. Inside click hander, the code was canceling all propagation with

    return false;

Removing this return statement solved problem with input=file.

like image 40
Mitja Gustin Avatar answered Nov 05 '22 11:11

Mitja Gustin


There's no reason that this shouldn't work in Chrome. Have you tried copying JUST the mark up in the example you've given us into a HTML file, and opening that? Does it work? It should, unless there's some third party plugin or extension stopping it.

It may be that you have have mark up elsewhere causing this issue; perhaps a layer over the input field catching the click event before it can make it's way down to the "browse" button?

like image 9
Philip Bennison Avatar answered Nov 05 '22 09:11

Philip Bennison


I knew the problem wasn't an issue with the specific web page I was currently browsing because I went to codepen and tried various file uploaders to no avail.

In my specific scenario, I had run a chrome update a few days ago but failed to relaunch chrome after the update.

Navigating to Help > About Google Chrome, Google had informed me that a relaunch was necessary.

After relaunch, the browser native file picker started appearing again.

like image 8
Tim Joyce Avatar answered Nov 05 '22 09:11

Tim Joyce


I had the same issue, it would work in safari but not chrome. Turns out I just needed to update my chrome browser. Apparently if your chrome version is out of date by two weeks functionality that has been around for over a decade breaks...you know google engineering at its finest...

like image 7
Linguistics Avatar answered Nov 05 '22 10:11

Linguistics