How to get file input by selected file name without path using jQuery ?
The task is to get the file input by selected filename without the path using jQuery. To select the file we will use HTML <input type=”file”>. After that we will get the file name by using the jQuery change() method. This method is used in the JQuery to get the file input by selected file name. And the HTML <input type=”file”> is used to specify the file select field and add a button to choose a file for upload to the form.
Below examples illustrates the approach:
Example 1: In this example we will display the file name with the extension by using the change() method and the file will be selected by the HTML <input type=”file”>.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.
Example 2: In this example we will display the filename with the extension through an alert, by using the change() method and the file will be selected by the HTML <input type=”file”>.
You can learn jQuery from the ground up by following this jQuery Tutorial and jQuery Examples.