Asp.net mvc 2 不允许上传mvc2 HTTP POST

Asp.net mvc 2 不允许上传mvc2 HTTP POST,asp.net-mvc-2,uploadify,Asp.net Mvc 2,Uploadify,嗨,我在本教程中做了所有类似的事情 但当我尝试上传文件时,每次我收到POST not allowed error时,我都会签入fiddler并获取作品,例如: GET /Scripts/uploadify/uploadify.swf?preventswfcaching=1348057301853 HTTP/1.1 但邮政不是 POST /Scripts/uploadify/uploadify.swf HTTP/1.1 my controller方法的标头如下所示: [HttpPost] pu

嗨,我在本教程中做了所有类似的事情

但当我尝试上传文件时,每次我收到POST not allowed error时,我都会签入fiddler并获取作品,例如:

GET /Scripts/uploadify/uploadify.swf?preventswfcaching=1348057301853 HTTP/1.1
但邮政不是

POST /Scripts/uploadify/uploadify.swf HTTP/1.1
my controller方法的标头如下所示:

[HttpPost]
public string UploadFiles(HttpPostedFileBase FileData, FormCollection forms)
{
和jquery实现,如:

$(document).ready(function () {

// Multiple files - single input
var auth = "<% = Request.Cookies[FormsAuthentication.FormsCookieName]==null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value %>";
var ASPSESSID = "dfgdf";
var entryID = "<%= ViewData["EntryID"] %>";

$("#file_upload").uploadify({
'uploader': '<%= Url.Content("~/Scripts/uploadify/uploadify.swf") %>',
'script': '<%= Url.Action("uploadFiles","Home") %>',
'scriptData': { ASPSESSID: ASPSESSID, AUTHID: auth, entryID: entryID },
'fileDataName': 'FileData',
'buttonText': 'Select files',
'multi': true,
'width': 250,
'sizeLimit': 200000000,
'simUploadLimit': 1,
'cancelImg': '<%= Url.Content("~/Scripts/uploadify/uploadify-cancel.png") %>',
'folder': '/Content',
'auto': false,
'removeCompleted' : false,
'onAllComplete' : function(event,data) {
alert(data.filesUploaded + ' files uploaded successfully!');

},
'onSelectOnce' : function(event,data) {
$("#uploadLink").show();
}

});

});
$(文档).ready(函数(){
//多个文件-单个输入
var auth=“”;
var aspsessiond=“dfgdf”;
var entryID=“”;
$(“#文件上传”).uploadify({
“上传者”:“,
“脚本”:“,
'scriptData':{aspsessiond:aspsessiond,AUTHID:auth,entryID:entryID},
'fileDataName':'FileData',
'按钮文本':'选择文件',
"多":对,,
“宽度”:250,
“sizeLimit”:200000000,
“simUploadLimit”:1,
“cancelImg”:“,
'文件夹':'/Content',
“自动”:false,
“removeCompleted”:false,
“onAllComplete”:函数(事件、数据){
警报(data.filesuppload+“文件已成功上载!”);
},
“onSelectOnce”:函数(事件、数据){
$(“#uploadLink”).show();
}
});
});

本教程似乎是指一些较旧版本的Uploadify,现在选项有点不同,您可以找到最新的列表

我已经更新了您的代码(我已经注释了似乎不再存在的选项):

$(“文件上传”).uploadify({
“swf”:“,
“上传者”:“,
'formData':{aspsessiond:aspsessiond,AUTHID:auth,entryID:entryID},
'fileObjName':'FileData',
'按钮文本':'选择文件',
"多":对,,
“宽度”:250,
“文件大小限制”:200000000,
//“simUploadLimit”:1,
//“cancelImg”:“,
//'文件夹':'/Content',
“自动”:false,
“removeCompleted”:false,
“onQueueComplete”:函数(事件、数据){
警报(data.filesuppload+“文件已成功上载!”);
},
“onSelect”:函数(事件、数据){
$(“#uploadLink”).show();
}
});

如果您愿意分享您的一些代码,那将很有帮助。通过阅读教程,您应该首先在uploadFiles方法上添加[HttpPost]属性。
$("#file_upload").uploadify({
    'swf': '<%= Url.Content("~/Scripts/uploadify/uploadify.swf") %>',
    'uploader': '<%= Url.Action("uploadFiles","Home") %>',
    'formData': { ASPSESSID: ASPSESSID, AUTHID: auth, entryID: entryID },
    'fileObjName': 'FileData',
    'buttonText': 'Select files',
    'multi': true,
    'width': 250,
    'fileSizeLimit': 200000000,
    //'simUploadLimit': 1,
    //'cancelImg': '<%= Url.Content("~/Scripts/uploadify/uploadify-cancel.png") %>',
    //'folder': '/Content',
    'auto': false,
    'removeCompleted': false,
    'onQueueComplete': function(event,data) {
        alert(data.filesUploaded + ' files uploaded successfully!');
    },
    'onSelect' : function(event,data) {
        $("#uploadLink").show();
    }
});