我正在使用uploadify v3.1 for MVC3 C#。MVC3 uploadify Jquery插件錯誤HTTP 404和IO錯誤
我CSHTML代碼
<div class="container_24">
<input type="file" name="file_upload" id="file_upload" />
</div>
我的js代碼是
$(document).ready(function() {
$('#file_upload').uploadify({
'method': 'post',
'swf': '../../Scripts/uploadify-v3.1/uploadify.swf',
'uploader': 'DashBoard/UploadFile'
});
});
而控制器代碼是
[HttpPost]
public ActionResult UploadFile(HttpPostedFileBase file)
{
// Verify that the user selected a file
if (file != null && file.ContentLength > 0)
{
// extract only the fielname
var fileName = Path.GetFileName(file.FileName);
// store the file inside ~/App_Data/uploads folder
var path = Path.Combine(Server.MapPath("~/Uploads"), fileName);
file.SaveAs(path);
}
// redirect back to the index action to show the form once again
return RedirectToAction("Index", "Home");
}
現在,當我點擊上傳按鈕,它顯示了兩個錯誤,有時它顯示IO錯誤並且有時顯示HTTP 404某些文件錯誤。哪裏不對 ?請幫幫我 ?
使用Asp.net MVC幫助程序生成路徑:''swf':'@(Url.Content(「〜/ Scripts/uploadify-v3.1/uploadify.swf」))', 'uploader' :'@(Url.Action(「DashBoard」,「UploadFile」))''。您還可以設置一個[onUploadError](http://www.uploadify.com/documentation/uploadify/onuploaderror/)來了解有關錯誤原因的更多信息。 – nemesv 2012-07-09 20:32:57
謝謝你的評論,但你的想法是行不通的:(我應該現在不應該怎麼辦? – zxprince 2012-07-09 22:48:19