Uncaught TypeError: Cannot read property 'name' of undefined-Collection of common programming errors

I have the following code for when ‘choose file’ is clicked:

$(':file').change(function () {

if(this.files.length == 1) {
    $('#selected_files').html("

Attaching " + this.files.length + " file

");
} else {
    $('#selected_files').html("

Attaching " + this.files.length + " files

");
}

$('#selected_files').append("

“); for(x=0;x

Filename Size

Originally posted 2013-11-09 19:43:48.