I am working with an application that provides the possibility for the user to upload certain files on the server. And that works fine. But now i want to check the file endings via JavaScript to make sure that the user can only upload files of a certain format. For example: *.txt
Therefore i want to read the filename and check the ending. My problem is, that i don't know how to access the filename. I know that its quite simple to get the value of string via: document.getElementById('Field').value -> this works for me.
But how can i access the filename of a file? Do i need to transform them into files with something like fileReader? Isn't there an easier way to just get the filename.
Update: HTML5-solutions won't work for me. Isn't there an other way to do that without File-API?