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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
var fp = new Ext.FormPanel({
renderTo: document.body,
fileUpload: true,
width:492,
frame: true,
autoHeight: true,
bodyStyle: 'padding: 10px;',
labelWidth: 50,
defaults: {
anchor: '98%',
allowBlank: false,
msgTarget: 'side'
},
items: [
{
xtype: 'fileuploadfield',
id: 'form-file',
emptyText: 'Sélectionnez un fichier',
fieldLabel: 'Fichier',
name: 'attached_file',
buttonText: 'Sélectionnez un fichier',
buttonCfg: {
iconCls: 'files-win'
}
}
],
buttons: [
{
text: 'Envoyer',
handler: function(){
if(fp.getForm().isValid()){
fp.getForm().submit({
url: 'file-upload.php',
waitMsg: 'Téléchargement du fichier...',
success: function(){
file_win.close();
},
failure : function (response, opts) {
Ext.Msg.alert('An error occured with the server:\n'+response.responseText);
}
});
}
}
},{
text: 'Annuler',
handler: function(){
file_win.close();
}
}]
});
var file_win = new Ext.Window({
layout: 'form',
title: 'Ajouter un fichier',
closable: true,
resizable: false,
width: 500,
items:[fp]
});
file_win.show(); |
Partager