om. om. -3 years ago 157
Javascript Question

How to get uploaded file name

I want to access file name from

<input type="file">

I console
and get this result:

enter image description here

I want to use image name which highlighted in screenshot.

Answer Source

You can access the FileList using .files property. Get the File object at index 0 of FileList using bracket notation. Get the "name" property of the File object using .name

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download