| @@ -220,15 +220,14 @@ function upload_handler() { | |||
| else { | |||
| var reader = new FileReader(); | |||
| file['progress'] = 1; | |||
| $(reader).on({ | |||
| loadstart: upload_read_event, | |||
| load: upload_read_event, | |||
| loadend: upload_read_event, | |||
| progress: upload_read_event, | |||
| error: upload_read_event, | |||
| abort: upload_read_event | |||
| }); | |||
| $(reader).on('load', id, upload_read_event); | |||
| $(reader).on('loadstart', id, upload_read_event); | |||
| $(reader).on('loadend', id, upload_read_event); | |||
| $(reader).on('progress', id, upload_read_event); | |||
| $(reader).on('error', id, upload_read_event); | |||
| $(reader).on('abort', id, upload_read_event); | |||
| reader.readAsArrayBuffer(file.obj); | |||
| } | |||
| } | |||
| @@ -241,6 +240,13 @@ function upload_handler() { | |||
| } | |||
| function upload_read_event(e) { | |||
| if ( e.type == 'progress' ) { | |||
| var progress = Math.floor(e.originalEvent.loaded / e.originalEvent.total * 50); | |||
| if ( percent < 1 ) { percent = 1; } | |||
| if ( percent >= 100 ) { perc} | |||
| } | |||
| } | |||
| console.log(e); | |||
| } | |||