isdaviddong
9/25/2016 - 4:58 AM

非同步上傳檔案後端C# code

非同步上傳檔案後端C# code

        protected void Page_Load(object sender, EventArgs e)
        {
            HttpPostedFile file = null;
            if (Request.Files.Count > 0)
            {
                //找到檔案
                file = Request.Files[0];
                //儲存
                var filePath = Server.MapPath(System.IO.Path.GetFileName(file.FileName));
                file.SaveAs(filePath);
                //回應訊息
                Response.Write(filePath + " saved.");
                Response.End();
            }
        }