Working with names and extension

Suppose I have an option to upload a file of PDF/Word or may be few more format.

<form >
  <input type="file" name="pic" accept="image/*">
  <input type="submit">
</form>

Is it possible to retrieve the name of the document and its extension using javascript /jQuery ?

Yes that is stored in a property called files on the file element.

Thanks but could you please elaborate little bit.

Further elaboration is available at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Getting_information_on_selected_files

Thanks @Paul_Wilkins. Since I am converting the form values into a javascript object, do you think information related to file name and type could be included in the object as well?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.