0
嗨,我做的一切都是想在這個教程中clickUploadify MVC2 HTTP POST不alowed
但是當我嘗試上傳的文件,每次我得到了POST不允許的錯誤,我在拉琴檢查和GET例如作品:
GET /Scripts/uploadify/uploadify.swf?preventswfcaching=1348057301853 HTTP/1.1
但我後的控制器方法不
POST /Scripts/uploadify/uploadify.swf HTTP/1.1
頭的樣子:
[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();
}
});
});
這將是有益的,如果你會分享一些你的代碼。通過查看教程,您應該首先在uploadFiles方法上添加[HttpPost]屬性。 – tpeczek
@tpeczek編輯 – kosnkov