Buscar este blog

martes, 1 de julio de 2014

File upload EXTJS

CLIENTE(JS)

this.PANELBASICO = Ext.create('Ext.form.Panel',
{ width: 500, frame: true, title: 'File Upload Form', bodyPadding: '10 10 0',
 defaults:
{ anchor: '100%',
 allowBlank: false,
 msgTarget: 'side',
 labelWidth: 50 },
 items: [{
 xtype: 'textfield',
 fieldLabel: 'Name'
 },
{ xtype: 'filefield',
 id: 'form-file',
 emptyText: 'Select an image',
 fieldLabel: 'Photo',
 name: 'photo-path',
 buttonText: '',
 buttonConfig:
{ iconCls: 'upload-icon' }
 }], buttons:
[{ text: 'Save', handler: function()
{ var form = this.up('form').getForm();
 if(form.isValid()){ form.submit(
{ url: '/NombreServlet', waitMsg: 'Uploading your photo...', success: function(fp, o)
{ msg('Success', 'Processed file "' + o.result.file + '" on the server'); } }); } } },
{ text: 'Reset', handler: function()
{ this.up('form').getForm().reset(); } }]
 }); 

SERVIDOR(SERVLET)
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException
{
 //RECUPERAMOS LOS FICHEROS
 List items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request); 
 } 
Posicionamiento web: Visítanos aquí Carlos Javier Martín Cano

No hay comentarios: