-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