2013-01-01 2 views
0

내 코드는 Chrome에서 잘 작동하지만 IE에서는 오류가 발생합니다.jQuery image upload (blueimp) IE 9의 오류보고

빈 파일 업로드 결과

및 IE는 크로스 사이트 스크립팅 오류 메시지를 보여줍니다 메시지이다. 그러나 파일 업로드가 잘 작동합니다.

내 서버 링크로 "main.js"만 변경했습니다.

$(function() { 
    'use strict'; 

// Initialize the jQuery File Upload widget: 
$('#fileupload').fileupload({ 
    // Uncomment the following to send cross-domain cookies: 
    //xhrFields: {withCredentials: true}, 
// url: 'server/php/' 
    url: './jQuery-File-Upload-master/server/php/' 
}); 

// Enable iframe cross-domain access via redirect option: 
$('#fileupload').fileupload(
    'option', 
    'redirect', 
    window.location.href.replace(
     /\/[^\/]*$/, 
     './jQuery-File-Upload-master/cors/result.html?%s' 
    ) 
); 

if (window.location.hostname === 'mimong4.cafe24.com') { 
    // Demo settings: 
    $('#fileupload').fileupload('option', { 
     url: './jQuery-File-Upload-master/server/php/index.php', 
     maxFileSize: 5000000, 
     acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/I, 
     process: [ 
      { 
       action: 'load', 
       fileTypes: /^image\/(gif|jpeg|png)$/, 
       maxFileSize: 20000000 // 20MB 
      }, 
      { 
       action: 'resize', 
       maxWidth: 1440, 
       maxHeight: 900 
      }, 
      { 
       action: 'save' 
      } 
     ] 
    }); 
    // Upload server status check for browsers with CORS support: 
    if ($.support.cors) { 
     $.ajax({ 
      url: './jQuery-File-Upload-master/server/php/index.php', 
      type: 'HEAD' 
     }).fail(function() { 
      $('<span class="alert alert-error"/>') 
       .text('Upload server currently unavailable - ' + 
         new Date()) 
       .appendTo('#fileupload'); 
     }); 
    } 
} else { 
    // Load existing files: 
    $.ajax({ 
     // Uncomment the following to send cross-domain cookies: 
     //xhrFields: {withCredentials: true}, 
     url: $('#fileupload').fileupload('option', 'url'), 
     dataType: 'json', 
     context: $('#fileupload')[0] 
    }).done(function (result) { 
     $(this).fileupload('option', 'done') 
      .call(this, null, {result: result}); 
    }); 
} 

}); 

답변

3

IE9는 사이트 간 iframe 전송을 사용합니다.

세 번째 매개 변수는 도메인 간 문제를 극복하기 위해 원본 서버 (업로드 서버 아님)에 있어야하는 cors/result.html을 가리키는 URL이어야합니다.

// Enable iframe cross-domain access via redirect option: 
$('#fileupload').fileupload(
    'option', 
    'redirect', 
    'http://mimong4.cafe24.com/result.html?%s' 
    ) 
); 

https://github.com/blueimp/jQuery-File-Upload/wiki/Cross-domain-uploads

관련 문제