Input type file is not working on Chrome?

1.6k views Asked by At

I am building a fullStack project with react where you can create posts. I am trying to use input type file to upload a picture, but when I click the choose file button, the pop up window does not appear. Here is the input:

<input type="file" onChange={e => setPhoto(e.currentTarget.files[0])} />

This isn't working. I tried changing onChange for onInput and it is still not working. I also looked around to make sure it wasn't nested inside another element that had e.stopPropagation or e.preventDefault. It is not. I tried placing it in different parts of my code and components and it still isn't working.

Something that I found curious is that, this issue is happening on Chrome. When I checked my localhost on Safari, the window where I can select the file pops up.

0

There are 0 answers