如何在 jquery uploadFile 方法中获取 return 对象

How to get return object in jquery uploadFile method

这是上传js代码

manageMedia_Uploader = $("#fileuploader").uploadFile({
    url: "/Ajax/JsonProvider?Method=SaveMedia",
    fileName: "Media",
    autoSubmit: false,
    multiple: false,
    maxFileCount: 1,
    acceptFiles: "audio/*,video/*,image/*",
    showStatusAfterError: true,
    dynamicFormData: function () {
        return { MediaFriendlyName: $("#ManageMedia-MediaFriendlyName").val(), MediaID: mediaID }
    },
    afterUploadAll: function (result) {
        console.log("MEDIAID: " + result.CommonGenericObject);
        if (mediaID!=0)
            Management_ManageMedia.GoToMediaManagement();
    },
    onError: function (files, status, errMsg, pd) {
        Management_ManageMedia.GoToMediaManagement();
    },
    onCancel: function (files, pd) {
        Management_ManageMedia.GoToMediaManagement();
    }
});

},

和 ajax.cs

的 SaveMedia
public CommonDto SaveMedia(){
    Common.MediaType mediaType = Common.MediaType.Unknowm;
    CommonDto result = new CommonDto();
     if (fileExtension == ".webm" || fileExtension == ".mkv" || fileExtension == ".flv" || fileExtension == ".vob" || fileExtension == ".ogv" || fileExtension == ".avi" || fileExtension == ".wmv" || fileExtension == ".mp4" || fileExtension == ".mpg" || fileExtension == ".mpeg" || fileExtension == ".flv")
    {
        mediaType = Common.MediaType.Video;
    }
    else if (fileExtension == ".jpg" || fileExtension == ".jpeg" || fileExtension == ".gif" || fileExtension == ".png" || fileExtension == ".gif" || fileExtension == ".bmp")
    {
        mediaType = Common.MediaType.Image;
    }

    if (mediaType == Common.MediaType.Unknowm)
    {
        notification.NotificationMessage = notification.NotificationMessage = LocalizeHelper.GetLanguageResource("aabcc9eb-26f7-4c42-b355-4f23ce9f5d62", "{en: 'Please upload a media as allowed types', tr: 'Lütfen izin verilen türde bir medya yükleyin', ar: 'يرجى تحميل وسائط كأنواع مسموح بها'}", SessionHelper.GetUser<UserDto>().LanguageID, false);
        notification.NotificationType = Common.NotificationType.Warning;
    }
    media.Mediatype=(int)mediaType
    result.CommonGenericObject = media;

    result.CommonNotification = notification;
    return result;
}

普通cs

public enum MediaType
    {
     Unknowm = 0,
     Image = 1,
     Video = 2,
     Audio = 3
    }

问题是我想在开始上传之前获取媒体类型,如果 mediatype=0 给出错误但我无法达到 result.CommonGenericObject.MediaType 为什么?有什么办法得到它吗?在开始上传之前我需要使用哪个功能来给出错误?

我明白了

(JSON.parse(result.responses)).CommonGenericObject