2

I am trying to upload file using EXtjs .

{(
    fileUpload: true,
    autoHeight: true,
    width: 300,
    labelWidth : 100,
    bodyStyle:'padding: 5px 5px 0',
    items: [{
        xtype: 'fileuploadfield',
        fieldLabel: 'File',
        name: "fileField",
        width: 250,
        id :'filenamewo'
    }]

userForm.getForm().submit({
    url : "uploadFile.do",
    method: 'POST',
    headers: {'Content-Type':'multipart/form-data; charset=UTF-8'}
})

After submit, in servlet I can get file content, but it also contains header details as show below:

------WebKitFormBoundaryOAN4TnbKHJgVxoMV
Content-Disposition: form-data; name="fileField"; filename="testsxls.xls" 
Content-Type: application/vnd.ms-excel
------

WebKitFormBoundaryOAN4TnbKHJgVxoMV--

I want to get the file content out of this request payload.
I am very new to EXtjs and struts
I am using EXTJs 3 and Struts with JAVA.

My basic requirement is to upload file(.xls).
Its existing project, just need to add a feature to upload the file to server.
Can some one help me? Thanks in advance.

ULLAS K
  • 609
  • 2
  • 7
  • 21
  • Struts2 upload files automatically. Just ensure to put the three variables needed, with getters and setters, and to use, among the others, the FileUploadInterceptor, placed in the right place. If you haven't touched anything, it is already there, and in the right place. Example: http://stackoverflow.com/a/20740352/1654265 . You can also easily upload multiple files concurrently: http://stackoverflow.com/a/17212916/1654265 – Andrea Ligios Apr 16 '15 at 14:18

0 Answers0