/// <summary>
/// 这是图件的上传
/// </summary>
/// 创建时间:2012/06/27
public string tujian()
{
string path = "";
if (FileUpload1.HasFile)
{
if (FileUpload1.PostedFile.ContentLength > 1000 * 1000)
{
Response.Write("过大");
}
else
{
if (FileUpload1.PostedFile.FileName.Substring(FileUpload1.PostedFile.FileName.LastIndexOf(".")).ToLower() != ".jpg")
{
ClientScript.RegisterStartupScript(this.GetType(), "a1", "<script>alert('格式不正确')</script>");
}
else
{
string strFileNewName = DateTime.Now.ToString("yyyyMMddhhmmss") ;
// FileUpload1.SaveAs(@"E:\"+FileUpload1.FileName);
FileUpload1.SaveAs(Server.MapPath("FileExcel") + "\\" + strFileNewName+FileUpload1.FileName);
//获取刚刚上传文件路径
path = strFileNewName + FileUpload1.FileName ;
//ClientScript.RegisterStartupScript(GetType(), "xxx", "<script>alert('上传成功');</script>");
string s = string.Format("<script>alert('{0}')</script>", "上传成功!");
ClientScript.RegisterStartupScript(this.GetType(), "xxx", s);
}
}
}
return path;
}