Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save isdaviddong/bb205bba7b4ca29e28b552dea0b077e1 to your computer and use it in GitHub Desktop.
Save isdaviddong/bb205bba7b4ca29e28b552dea0b077e1 to your computer and use it in GitHub Desktop.
非同步上傳檔案後端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();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment