Recently the user reflects the hope that we put the online editor of the multi-image upload function, because they often have to edit the product description of the need to upload more than one picture, if you want to choose the efficiency is very low, the customer's demand is our pursuit, soon we put the perfect function into the schedule, the request to achieve as soon as possible.
The online editor we use in the project is kindeditor4.1.10 their multi-file upload plugin is using the flash realized, originally should be able to use, but why always show upload failure, Baidu has a bit of experience and lessons from the predecessors, there are two possible: 1 ) uploaded target folder does not have write permission, resulting in the uploaded file cannot write operation, so upload failed; Span style= "Font-family:times New Roman" >2 ) There are systems that do permission validation because of the use of flash When uploading, because on upload flash plugin did not put bring past, cause session missing causes upload to fail.
We are doing a single and multiple uploads of the target path is in the same parent folder, so it will not be the first case caused, it is only the second case, based on such a judgment, it will be in the Flash upload manually add SessionId parameters and values, to the service side of the time to receive the application to the Session , this should be able to solve the problem, it turns out that the idea is correct, the following specific methods of operation.
Open it/kindeditor/plugins/multiimage/multiimage.js, findPostparamsThis configuration item, the original configurationPostparams:k.undef (Self.extrafileuploadparams, {}),insteadpostparams: $.extend (K.undef (Self.extrafileuploadparams, {}), {"__jentianyunsessionid": Jt.cookie (' __ Jentianyunsessionid ')}),above the__jentianyunsessionidshould be replaced by yours.sessionIdof thenameproperty, so that you canFlashwhen uploading the file, put yourSessionIdTo the Server page, and then to the beginning of the page to process the uploaded file plus
$session =\tools\tools::allchar (' __jentianyunsessionid ');
if ($session) {// reset cookiesto solve The loss of cookies when uploading images using Flash
session_id ($session);
Session_Start ();
}
In this way, kindeditor/Flash implementation of multi-file (image) upload will be successful
The solution of uploading failure when uploading multiple files (Pictures) using Kindeditor/uploading with Flash upload multiple files (picture) upload failed