View Full Version : File upload problem

11 Jan 2012, 4:58 AM

When i upload file using example http://docs.sencha.com/ext-js/4-0/#!/example/form/file-upload.html
In IE8 or in compatability mode i get IE exeption, but it works in FF.
When i use fiddler to watch for http trafic. It seems that
Client request heaers:
Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Server response:
Content-Type: application/x-ms-application
But inside is normal good json. And olso images are saved but UI freeze at this uploading.

Client request heaers:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Server response:
Content-Type: text/html
And everything wokk fine

I am confused where is the problem!?

And the second problem is that i want to add chencel button under the progress bar.

12 Jan 2012, 11:33 AM

I have found a solution it was server problem.

@RequestMapping(value = "/uploadfile", method = RequestMethod.POST)
public @ResponseBody ResponseEntity<String> uploadNewImage(@RequestParam("name") String name, @RequestParam("file") MultipartFile file) throws IOException
//response.setContenttype( "text/html; charset=utf-8"); not woking/ that was my bad and problem
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.add("Content-Type", "text/html; charset=utf-8");
return new ResponseEntity<String>("{success: true}", responseHeaders, HttpStatus.CREATED);

But i have a one question not solved. How can i add cancel button to the generic "Please wait" progress bar window?
Any suggestion?

13 Jan 2012, 12:03 PM
Hi everyone i found a solution:

Ext.MessageBox.show({ title:'Save Changes?', msg: 'You are closing a tab that has unsaved changes. <br />Would you like to save your changes?', buttons: Ext.MessageBox.YESNOCANCEL, fn: showResult, animateTarget: 'mb4', icon: Ext.MessageBox.QUESTION })})

and here in
Ext.MessageBox.show i can build what buttons and window i prefer cool. Pity that nobody know that.