files onload

files onload

hey guys i'm having a little trouble when it comes to firing a onload function when selecting files on local drive.

if i select multiple files to upload it can take a few up to 5 seconds for anything to happen due to how many images i upload and their size.

i'm trying to use:

  1. this.files.onload = function(){
                    console.log('started');
                };


but i'm not getting any response.

ideally i'd like to know when files have loaded and finished...is and how is this possible please?


thank you


  1.     $('.upload-container').on('change', 'input[name="images[]"]', function(){
            var files_length = this.files.length,
                count          = files_length + $("li[id^='image-'] img").length;

            this.files.onload = function(){
                    console.log('started');
                };

                this.files.onreadystatechange = function(){
                    if (this.files.readyState == "loaded" || this.files.readyState == "complete"){
                        console.log('ended');
                    }
                };
               
             if (count > max_images){
                 upload_status('Too many images selected.');
              }
              
             for (var i = 0; i < files_length; i++, id++) {
                      read_file(this.files[i], id);
              }
        });