我想實現blueimp我的codeigniter項目多圖像上傳的圖像。 我面臨500(內部服務器錯誤)我知道這出現如果我們的PHP腳本中有任何錯誤。 在我的PHP腳本我得到的迴應爲{「files」:[]}表示img的存在於我的img_upload文件夾中。它必須返回空對象是真的,但Blueimp Codeigniter圖像上傳ajax 500內部服務器錯誤
當我點擊匿名函數這裏my.js重定向到下面的函數。
$.ajax({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
url: $('#fileupload').fileupload('option', 'url'),
dataType: 'json',
context: $('#fileupload')[0]
}).always(function() {
$(this).removeClass('fileupload-processing');
}).done(function (result) {
$(this).fileupload('option', 'done')
.call(this, $.Event('done'), {result: result});
});
我在想這可能是返回類型html或json的問題,但無法得到如何解決這個問題。我如何解決這個問題,所以我可以上傳圖像而不會出現內部錯誤。提前致謝。
我跟隨以下github維基,我的代碼是相同的。
添加後端PHP代碼,請 – 0x13a