`

简单的.net文件上传文件代码

阅读更多

简单的 .net 文件上传 C#代码

public void Upload(FileUpload fu)
{
string temppath = HttpContext.Current.Request.PhysicalApplicationPath + "tempdata";
if (System.IO.Directory.Exists(temppath))
{
//
}
else
{
//
System.IO.Directory.CreateDirectory(temppath);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
if (fu.HasFile)
{
fu.SaveAs(temppath+"\\"+fu.FileName.Substring(fu.FileName.LastIndexOf("\\")+1));
}


}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics