0
以下是我的形式上傳圖像到服務器阿賈克斯
<form id="postProblemForm" action="/Problems/Post" method="post">
<input type="text" id="problemSubject" name="problemSubject" class="inp-form"/>
<input type="file" id="uploadFile" name="uploadFile"/>
<textarea rows="" cols="" class="form-textarea" id="problemDescription" name="problemDescription"></textarea>
</form>
我必須填寫此表並控制器。控制器代碼是
[HttpPost]
public void Post(FormCollection form)
{
string subject = form["problemSubject"];
string description = form["problemDescription"];
HttpPostedFileBase photo = Request.Files["uploadFile"];
}
我可以很容易地得到「problemSubject」和「problemDescription」值。但不知道如何獲取上傳的圖像並將其保存在服務器端。我想保存在「〜/ ProblemImages」。請幫助。
您是否諮詢過Google或MDN? – gdoron 2013-04-11 05:19:53
是的。但不滿意。 – 2013-04-11 05:21:44
你的搜索關鍵字是什麼?你有沒有嘗試類似於:'在谷歌中用jQuery上傳文件?我相信你現在已經得到了答案。 – gdoron 2013-04-11 05:23:36