MVC3 C# に Uploadify v3.1 を使用しています。
私の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");
}
アップロード ボタンをクリックすると、2 つのエラーが表示されます。IO エラーが表示される場合もあれば、ファイルのHTTP 404エラーが表示される場合もあります。なにが問題ですか ?お願い助けて ?