Skip to content
Related Articles
Open in App
Not now

Related Articles

JavaScript | WebAPI | File | Property

Improve Article
Save Article
  • Last Updated : 18 Jan, 2019
Improve Article
Save Article

The 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 =;

Return Value: It returns a string, containing the name of the file without path.


<!DOCTYPE html>
            WebAPI Property
            #main {
                padding: 10px;
                width: 300px;
                border: 1px solid green;
        <div id = "main">
            <input type = "file" multiple onchange 
                = "myGeeks(this)">
        <script type="text/javascript">
            function myGeeks(input_file) {
                var files = input_file.files;
                for (var i = 0; i < files.length; i++) {
                    alert("Name of file:" + files[i].name);


Supported Browsers: The browser supported by WebAPI property are listed below:

  • Edge 12
  • Google Chrome 13
  • Firefox 3.6
  • Opera 16
  • Internet Explorer 10
  • Safari


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!