我正在使用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