php中kindeditor多图上传session丢失问题解决

解决办法:

1.在创建文本编辑器时增加session_id的传递

  1. <script>
  2. var editor;
  3. KindEditor.ready(function(K) {
  4. editor = K.create('textarea[name="content"]', {
  5. allowFileManager : true,
  6. extraFileUploadParams:{
  7. 'PHPSESSID' : "<?=session_id()?>"
  8. }
  9. });
  10. </script>
  11. <textarea name="content" >KindEditor</textarea>

2.upload_json.php文件增加session初始化

  1. $session=isset($_POST['PHPSESSID'])?$_POST['PHPSESSID']:'';
  2. if($session){//重新设置cookie,解决使用Flash上传图片时cookie丢失的问题
  3. session_id($session);
  4. session_start();
  5. }else{
  6. session_start();
  7. }