Pull to refresh

Асинхронная загрузка файлов, реализованная на YUI

Reading time 1 min
Views 1.4K
Cuong Tham написал пример, демонстрирующий асинхронную загрузку 5 файлов на сервер, использую YUI.

Код:
function init(){
var onUploadButtonClick = function(e){
//the second argument of setForm is crucial,
//which tells Connection Manager this is a file upload form
YAHOO.util.Connect.setForm('testForm', true);
var uploadHandler = {
upload: function(o) {
alert(o.responseText);
}
};
YAHOO.util.Connect.asyncRequest('POST', 'upload.php', uploadHandler);
};
YAHOO.util.Event.on('uploadButton', 'click', onUploadButtonClick);
}
YAHOO.util.Event.on(window, 'load', init);


Демо: http://test.thecodecentral.com/demos/asyncupload/
Подробности: http://thecodecentral.com/2007/09/04/asynchronous-file-upload-yuis-approach
Tags:
Hubs:
+1
Comments 4
Comments Comments 4

Articles