62,269
社区成员
发帖
与我相关
我的任务
分享
if (this.FUP.HasFile)//检查是否有文件
{
string fullFileName = this.FUP.PostedFile.FileName; //文件路径名
string fileName = fullFileName.Substring(fullFileName.LastIndexOf("\\") + 1); //附件名称
// string type = fullFileName.Substring(fullFileName.LastIndexOf(".") + 1); //图片格式
string path = HttpContext.Current.Request.MapPath("~/HT/useImg/");//获取上传文件的网站目录路径
this.FUP.SaveAs(path + fileName);//存储文件到磁盘
htUrl = "~/HT/useImg/" + fileName;
this.lblhtfj.Text = fileName;
Page.ClientScript.RegisterStartupScript(this.GetType(), "key003", "<script>alert('附件上传成功!');</script>");
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(),"key02","<script>alert('必须指定文件!');</script>");
}
if (this.FUP.HasFile)//检查是否有文件
{
string fullFileName = this.FUP.PostedFile.FileName; //文件路径名
string fileName = fullFileName.Substring(fullFileName.LastIndexOf("\\") + 1); //附件名称
// string type = fullFileName.Substring(fullFileName.LastIndexOf(".") + 1); //图片格式
string path = HttpContext.Current.Request.MapPath("~/HT/useImg/");//获取上传文件的网站目录路径
this.FUP.SaveAs(path + fileName);//存储文件到磁盘
htUrl = "~/HT/useImg/" + fileName;
this.lblhtfj.Text = fileName;
Page.ClientScript.RegisterStartupScript(this.GetType(), "key003", "<script>alert('附件上传成功!');</script>");
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(),"key02","<script>alert('必须指定文件!');</script>");
}