2
目前,我正在研究asp.net移動網站,並且我已經實現了一個與移動網站上傳文件相關的功能。在asp.net移動網站中添加文件上傳控件?
我使用的是asp:upload Control,但它並不適用於移動網站。
上週以來,我一直在谷歌搜索這個問題,但我找不到任何相關的來源或博客。
任何人都可以在這個話題上幫助我嗎?
目前,我正在研究asp.net移動網站,並且我已經實現了一個與移動網站上傳文件相關的功能。在asp.net移動網站中添加文件上傳控件?
我使用的是asp:upload Control,但它並不適用於移動網站。
上週以來,我一直在谷歌搜索這個問題,但我找不到任何相關的來源或博客。
任何人都可以在這個話題上幫助我嗎?
鑑於:
@using (Html.BeginForm("Index", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="file" />
<input type="submit" value="OK" />
}
在控制:
[HttpPost]
public ActionResult Index(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("~/App_Data/uploads"), fileName);
file.SaveAs(path);
}
// redirect back to the index action to show the form once again
return RedirectToAction("Index");
}
,並移除網頁jquerymobile腳本。像在MVC4中
@Scripts.Render("~/bundles/jquery", "~/bundles/jquerymobile")
刪除此行,它是衝突的來源。
檢查這一個:http://stackoverflow.com/questions/6947785/jquery-mobile-file-upload –
這是給我錯誤!我認爲這不支持jQuery。 – sikender