Problems encountered during File Upload using ajaxfileupload. js
Asynchronous upload value server is required for image uploading. At that time, ajax ajaxfileupload was used for image uploading. Here, write down the Step 1: use the $. ajaxFileUpload ({}); function. The webpage reports an error, prompting you that this function is not available. Solution: import the ajaxfileupload. js file. Simple 2: If the upload is successful, no callback is executed, that is, $. ajaxFileUpload ({url: ", // type: 'post', fileElementId: 'file', # id dataType: 'json ', data: {data to be uploaded}, # success function in success: function (data) {}, failure: function (data) {}}; can be omitted. You need to modify the source code of ajaxfileupload. js. All right, try uploadHttpData: function (r, type) {var data =! Type; data = type = "xml" | data? R. responseXML: r. responseText; if (type = "json") eval ("data =" + data) ;}, check eval function code function eval (s) {return new Object () ;}; nothing is returned. comment it out. if (type = "json") {data = data. replace ("<pre> ",""). replace ("</pre>", "");} this data. replace ("<pre> ",""). replace ("</pre>", ""); replace is a string of characters starting with <pre> In the json string returned during file upload. So you can write: if (type = "json") {data = data;} to execute the callback function. 3: An error is reported when the size of the uploaded file is greater than 2 MB, indicating that the file is too large. Oh, the picture is not 2, 3 M now! Solution: add this in the struts file. MB. Haha (there are many solutions here, you can search online) Well, end the manual work!