-1
我們如何將自定義錯誤消息傳遞給uploadify?uploadify onError not called
如果在控制器操作上有一個異常(由try/catch捕獲) - 我們如何將它傳遞給uploadify腳本? onError事件從不被調用?
[HttpPost]
public ActionResult Upload(HttpPostedFileBase fileData, FormCollection forms)
{
try
{
if (fileData.ContentLength > 0)
{
var statusCode = Helper.UploadList();
if (statusCode.Equals(System.Net.HttpStatusCode.Created))
return Json(new { success = true });
}
}
return Json(new { success = false });
}
catch (Exception ex)
{
return Json(new { success = false });
}
}
'onComplete': function (event, queueID, fileObj, response, data) {
if (response == '{"success":true}') {
alert("File uploaded successfully.");
}
else if (response == '{"success":false}') {
alert('File failed to upload. Please try again!');
}
else {
$("#file_uploadDomain").uploadifyCancel(queueID);
}
return false;
},
'onError': function(event, ID, fileObj, errorObj) {
alert(errorObj.type + ' Error: ' + errorObj.info);
},
那會已經容易得多......但response.success在的onComplete不確定的。 – GoldenUser 2012-04-17 22:51:39
沒關係,你是對的... – Tommy 2012-04-17 22:55:10
data.success和data.message都是undefined – GoldenUser 2012-04-17 22:56:04