spring mvc - Ext Js Filefield issue in Internet Explorer8 and 9 -


I have a file field in my form. When I submit the form through the controller, showing the IE security bar That's what I'm trying to download a file on the computer, which is exactly what I'm doing (I'm uploading a file). And everything works great when I submit the form to the server using FF. But there is a problem with IE8 and Ie 9.

Administrator action:

  var myForm = Ext.getCmp ('uploaddraftpcpPanel'). GetForm (); // Get original form if (myForm.isValid ()) {// Make sure the form contains valid data before submitting my form ({header: {enctype: 'multipart / form-data; charset = UTF-8 '}, Url:' upload / uploaddraftpcp.action ', success: work (myForm, verb) {Ext.Msg.alert (' success', "success");}, failure: function (myForm, action) {Ext. Msg warning ('failed', 'unsuccessful');}}); } Else {// display error warning if the data is invalid Ext.Msg.alert ('Invalid data', 'Please fix errors.'); }   

The server side code looks like this:

  @RequestMapping (value = "/upload/uploaddraftpcp.action", method = RequestMethod.POST) Public @ Responseboard Map & lt; String ,? Object & gt; Expanded UploadDraftPCP (HTTPSArlate Request) (map & lt; string, object & gt; modelmap = new hashmop & lt; string, object & gt; (2); try {system.out.println ("title pcp" + request .getParameter ("title"); System.out.println ("description pcp" + request.getParameter ("description"); // response.setContentType ("text / html"); modelMap.put ("message" , "Successfully submitting form"); modelMap.put ("success", true); return modelmap;} hold (exception e) {System.out.println (e.toString ()); e.printStackTrace (); Return ExtJSReturn .mapError ("Error in Retrieving Data . ");}}    

, file upload does not use normal 'Ajax' techniques Instead, they do not use XMLHttpRequests, instead a hidden element with all the fields is created temporarily and stored with a set target to refer to the dynamically-generated, hidden Which is inserted into the document, but remove the return data after it is collected Or.

Respond is parsed by the browser to create a document for server IFRAME. If the server is using JSON to send the return object, then the Content-type header should be set to text / html> in order to insert the unchanged text Ask for documents in the body.

Chrome, FF, IE 10 and up only when they see Content-type = application / json in the feedback header. However, when you do that for IE8 and IE9, when a file upload from a server reponds, you see a message saying something along the line: "Do you want to open or save this document"?

, to decide whether to set content / type to text / html in IE8 and IE9 and you are okay, the modern browser gives only one response, so you can do anything with that solution Are not breaking.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -