开发者

Uploadify doesn't work on IE and chrome browsers and gives HTTP ERROR

开发者 https://www.devze.com 2023-04-05 15:04 出处:网络
I have setup uploadify which works fine on Firefox with mulitple image uploads. However, it doesn\'t on IE and Chrome.

I have setup uploadify which works fine on Firefox with mulitple image uploads. However, it doesn't on IE and Chrome.

Code:

    $("#file_upload").uploadify({
        'uploader'  : '/examples/uploadify/uploadify.swf',
        'script'    : '/examples/uploadify/uploadify-spotlight.php',
        'cancelImg' : '/examples/uploadify/cancel.png',
        'method'    : 'post',
        'debug' : true,
        'preventCaching'  : true,
        'multi'          : true,
        'fileExt'     : '*.jpg;application/jpeg;application/png',
        'fileDesc'    : 'Image Files (.JPG, .GIF, .PNG)',
        'sizeLimit'   : 62914560,
        'removeCompleted': false,
        'onSelectOnce'   : function(event,data) {
          $('#status-message').text(data.filesSelected + ' fil开发者_Go百科es have been added to the queue.');
        },
        'onAllComplete'  : function(event,data) {
          //successfull
        },
        'onError' : function (event, ID, fileObject, errorObj){
             //not Successfull
        }
});

DEBUGGING: It doesn't say anything in console with chrome.


OK I have figured out the reason for that myself. It is due to the session. Since it is the flash communicating with the back-end script, it doesn't pass on the session variable.

You need to do that explicity:

$("#upload").uploadify({
  ...
  'scriptData': { 'session': '<?php echo session_id();?>'}
  ...
});

Then call the session ID in your back-end script:

if ($_REQUEST['session']) session_id($_REQUEST['session']);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号