說實話,我不大清楚.aspx和.asmx究竟哪個比較好。我在這裏用的是.aspx,因爲我覺得更方便一些。
public partial class upload : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HttpFileCollection MyFilecollection = Request.Files;
MyFilecollection[0].SaveAs(Server.MapPath("~/ImageStore/" + MyFilecollection[0].FileName));
}
}
這樣iOS端通過Post方式傳遞過來的圖片就保存在服務器端了。