嗨,我做了本教程中的所有操作,点击
但是当我尝试上传文件时,每次出现 POST not allowed 错误时,我都会检查 fiddler 并且 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();
}
});
});