The File.name property is an inbuilt function of File WebAPI which gives the name of the file represented by a file object. The path of file is excluded from this property for security reasons.
var name = file.name;
Return Value: It returns a string, containing the name of the file without path.
Supported Browsers: The browser supported by WebAPI File.name property are listed below:
- Edge 12
- Google Chrome 13
- Firefox 3.6
- Opera 16
- Internet Explorer 10
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.