Reprint Please specify: theviper http://www.cnblogs.com/TheViper
Uploading on the PC side, often for compatibility, uses Flash (such as swfupload,uploadify) for a better user experience.
However, if the background is spring MVC and the browser is IE, the server will not return data to flash, triggering the Filereference dataevent.upload_complete_data event, the execution callback to the page corresponding changes. Oddly, in non-IE browsers, Flash will be able to get the data returned.
Change the log4j level to debug.
Ie
Non-IE
Can see two have received flash sent over the multipart file content, but IE debug has a httpmediatypenotacceptableexception. The document says exception thrown when the request handler cannot generate a response it's acceptable by the client. This will understand that the response returned in the background is not accepted by Flash.
So how did this problem come out?
Fortunately, flash upload in this cock node JS background can be run. The following is a look under IE Flash upload request header information.
And not under IE
Notice the IE head of the message inside the Accept: ' text/* '. This dick's spring MVC background returns JSON. and the most direct way. @RequestMapping (value= "/upload1", produces {"Application/json;charset=utf-8"}). In other words, the response is content-type:application/json;charset=utf-8. And then Flash only accepts content-type:text/* (Text/html,text/xml ...) The response. Non-IE header information is */*, can accept content-type for any type of response, Flash can of course accept the background response.
Know the problem where it is good to change, Ben here directly to the Application/json to text/*. If you return JSON or other forms of data in another way, be careful to set the response Content-type to match the Flash's accept. The concrete of this cock will not say.
In addition, if you modify the Flash source code, upload urlrequest Modify accept is useless, upload the time accept or flash in different browser default values.
var request:urlrequest=New urlrequest (' http://localhost:8080/qzone/photo/upload1 ' ); var New Urlrequestheader ("Accept""Application/json"); Request.requestHeaders.push (header);
Issues with flash upload in spring MVC