Hi Andrew,
Thanks for making up this code, it's great.
Are there any examples of using this with xmlhttprequest() ?
I've had trouble convincing this code to handle properly: (file is
undefined, even though I'm sending using formData()); Thanks!
$(function() {
$('input').on('click', function(evt) {
evt.preventDefault();
$('div.progress').show();
var formData = new FormData();
var file = document.getElementById('myFile').files[0];
formData.append('myFile', file);
var xhr = new XMLHttpRequest();
xhr.open('post', '/', true);
xhr.upload.onprogress = function(e) {
if (e.lengthComputable) {
var percentage = (e.loaded / e.total) * 100;
$('div.progress div.bar').css('width', percentage + '%');
}
};
xhr.onload = function() {
$('div.progress').hide();
$('strong.message').text(this.statusText)
$('div.alert').show();
}
xhr.send(formData);
})
});
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en