1.ajaxfileupload上傳的時候出現錯誤,無法獲取錯誤信息,需要在ajaxfileupload.js的源碼中加入以下代碼
handleError: function (s, xhr, status, e) { // If a local callback was specified, fire it if (s.error) { s.error.call(s.context || s, xhr, status, e); } // Fire the global callback if (s.global) { (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e]); } },
插入代碼的位置為

2.ajaxfileupload在上傳的時候如果需要進行傳遞參數的時候,需要在ajaxfileupload.js的源碼中修改以下代碼,改動如圖中標注位置


3.當使用ajaxfileupload進行二級域名跨域上傳的時候,需要修改的內容為
(1) 調用上傳的html頁面所在域名是 www.abc.com ,添加document.domain
<script>
document.domain = "abc.com";
</script>
(2)上傳的服務端也需要進行document.domain注明
public ActionResult Upload()
{
string
message =
"上傳成功,文件大小:"
+ size;
json =
new
JsonResult
{
Data =
new
{
success =
true
,
message = message,
data =
new
{
name = name,
upload_name = upload_name,
extension = extension,
size = size,
url = url,
download_url = file_downloadpath + url
}
}
};
return
CrossDomainContent(json);
}
private
ContentResult CrossDomainContent(JsonResult json)
{
StringBuilder sb =
new
StringBuilder();
sb.Append(
"<script> document.domain = 'abc.com'; </script>"
);
sb.Append(JsonConvert.SerializeObject(json.Data));
return
Content(sb.ToString());
}
