1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| function BuildTLD(UF,FiltreUplaod, Affichage, MemFile) {
var button = $('#' + UF), interval;
$.ajax_upload(button, {
action: '/FileHandler.ashx' + FiltreUplaod,
name: 'myfile',
onSubmit: function (file, ext) {
// change button text, when user selects file
button.text('Uploading');
// If you want to allow uploading only 1 file at time,
// you can disable upload button
this.disable();
// Uploding -> Uploading. -> Uploading...
interval = window.setInterval(function () {
var text = button.text();
if (button.text().length < 13) {
button.text(button.text() + '.');
} else {
button.text('Uploading');
}
}, 200);
},
onComplete: function (file, response) {
button.text('Upload');
window.clearInterval(interval);
// enable upload button
this.enable();
if (response.indexOf("success") != -1) {
$('#' + Affichage).text('Fichier:' + file);
$('#' + MemFile).text(file);
}
else {
var Ret = new function () {
this.Reussi = false;
this.Msg = "Erreur chargement fichier";
}
AfficheMsgRetour(Ret)
}
}
});
} |
Partager