Skip to content

Commit 6191b71

Browse files
author
Pablo Brasero
committedOct 20, 2010
Define events BEFORE open, or Firefox won't do progress events
1 parent 0424120 commit 6191b71

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎example_html5_upload.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
var file = fileInput.files[0];
2222
2323
var xhr = new XMLHttpRequest();
24-
xhr.open('POST', '/', true);
2524
xhr.upload.addEventListener('loadstart', onloadstartHandler, false);
2625
xhr.upload.addEventListener('progress', onprogressHandler, false);
2726
xhr.upload.addEventListener('load', onloadHandler, false);
2827
xhr.addEventListener('readystatechange', onreadystatechangeHandler, false);
28+
xhr.open('POST', '/', true);
2929
xhr.setRequestHeader("Content-Type", "application/octet-stream");
3030
xhr.setRequestHeader("X-File-Name", file.name);
3131
xhr.send(file); // Simple!

0 commit comments

Comments
 (0)
Failed to load comments.