PDA

View Full Version : File upload problem



Romick
11 Jan 2012, 4:58 AM
Hi!

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.
30618
When i use fiddler to watch for http trafic. It seems that
IE:
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.

FF:
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.

Romick
12 Jan 2012, 11:33 AM
Hello!

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?

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


form.submit({
......
waitMsgTarget:
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.