I haven't used HTML5 File API much, so am pretty new to it.
I am trying to get the width and height of a file from the file upload field '#submission-file' field into two variables.
Here is the code I have:
var fileWidth = 0;
var fileHeight = 0;
var url = window.URL || window.webkitURL;
var fileField = $('#submission-file')[0].files[0];
var image = new Image();
image.onload = function() {
fileWidth = $('#submission-file').width;
fileHeight = $('#submission-file').height;
};
image.src = url.createObjectURL(fileField);
Can anyone show me what I am doing wrong?
onloadcallback. When theonloadcallback is called above, the file should be loaded - thus, he should be able to access those properties.