From the course: HTML5: File API

Unlock the full course today

Join today to access over 22,300 courses taught by industry experts or purchase this course individually.

Getting information about the file

Getting information about the file - HTML Tutorial

From the course: HTML5: File API

Start my 1-month free trial

Getting information about the file

Okay, now that we have seen how to select a file using the File Input element, let's take a look at the next step, which is getting information about a file. Here, I've opened my file_information_start version of the example and I've got my snippets open to the File Information section. So you can see that I've left the starting point of the previous example in place. We are not going to copy and paste the-- checking to see if the browser supports the file API each time. So what I am going to do is copy from the snippets, these lines right here. Let's copy those and paste them in. We will put them in script block here, all right. So in this case, we are still listening for the "change" event on the Files Input element. Only in this case, when the "change" event fires, we are going to, inside the onFileChanged event handler, get some information about the file. We are going to do this by using the fileInterface and the fileInterface, provides some properties like the filename, the file…

Contents