如何使用Uploadify上传mp4和/或允许在IIS中上传mp4

时间:2015-03-10 21:11:54

标签: asp.net iis video file-upload uploadify

我正在开发一个应用程序,我们一直在使用Uploadify上传.wmv和.jpg。我已经添加了允许.mp4上传的功能,当本地上传时一切正常,但不能上传到服务器。在IIS中,我在每个适用的文件夹中添加了.mp4文件的视频/ mp4的MIME类型,并且可以播放文件(手动添加时)...但由于某种原因,我不能<使用Uploadify将.mp4文件上传到我的服务器。这是jQuery / javascript代码:

  $('#fileInput').uploadify({
            'uploader': 'uploadify/uploadify.swf',
            'script': './Upload.ashx',
            'cancelImg': 'uploadify/cancel.png',
            'auto': false,
            'multi': true,
            'fileExt': '*.jpg;*.jpeg;*.wmv;*.mp4',
            'fileDesc': 'Allowed Files (.JPG, .JPEG, .WMV, .MP4)',
            'queueSizeLimit': 3,
            'sizeLimit': 999999999,
            'buttonText': 'Browse Files',
            'onError': function(event, ID, fileObj, errorObj) {
                alert(errorObj.type + ' Error: ' + errorObj.info);
            },
            'onComplete': function(event, ID, fileObj, response, data) {
                fileNames += fileObj.name + ',';
            },
            'onAllComplete': function(event, data) {
                if (data.errors == 0) {
                    $.ajax({
                        type: "POST",
                        data: $.toJSON({
                            Name: $("[id$='txt_Name']").val(),
                            FileNames: fileNames,
                            Active: $("[id$='rdo_ActiveYes']")[0].checked,
                            Department: $("[id$='ddl_Department']").val(),
                            Category: $("[id$='ddl_Category']").val(),
                            Description: $("[id$='txt_Description']").val()
                            //YouTubeURL: $("[id$='txt_YouTubeURL']").val()


                        }),
                        url: "WebMethods.aspx/InsertVideo",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function(results) {
                            document.location.href = "./AddVideo.aspx";
                        },
                        error: function(xhr, status, errorThrown) {
                            alert(xhr.responseText);
                        }
                    });
                }
                else {
                    alert('There was an error uploading the files; process will be aborted');
                }
            }

        });

我在添加MIME类型后重新启动了IIS(6.0)并确保文件大小不是太大。我还能上传.jpg和.wmv。我是否需要允许上传文件类型&#39;在IIS的任何地方?或者还有其他我想念的东西?如果需要任何其他信息,请告诉我。

编辑:我从上传获得的错误是&#34; HTTP错误:500&#34;

1 个答案:

答案 0 :(得分:1)

deebs,

我会检查目标服务器上文件的写访问权限。例如,如果您尝试覆盖&#34; readonly&#34;它可能会给你一个错误。