I want to download the file with one button, “Download button”, which is pressed, will open the selection file, and if the file is selected, it should download it.
The view should not display input[type=file]any other labels, but just one button.
I know this is easy with jQuery or just javascript, but since I'm relatively new to Extjs, I write this here, looking for your help.
The following is an example of a file loader from the documentation. How can I customize it according to my needs:
Ext.create('Ext.form.Panel', {
title: 'Upload a Photo',
width: 400,
bodyPadding: 10,
frame: true,
renderTo: Ext.getBody(),
items: [{
xtype: 'filefield',
name: 'photo',
fieldLabel: 'Photo',
labelWidth: 50,
msgTarget: 'side',
allowBlank: false,
anchor: '100%',
buttonText: 'Select Photo...'
}],
buttons: [{
text: 'Upload',
handler: function() {
var form = this.up('form').getForm();
if(form.isValid()){
form.submit({
url: 'photo-upload.php',
waitMsg: 'Uploading your photo...',
success: function(fp, o) {
Ext.Msg.alert('Success', 'Your photo "' + o.result.file + '" has been uploaded.');
}
});
}
}
}]
});
source
share