AspnetUpload upldr = new AspnetUpload();
UploadFile file = upldr.GetUploadFile("file1");
if (file != null)
{
if (file.get_ContentLength() > 1024*800)
{
string validate1 = @"
";
RegisterStartupScript("validatelenScript",validate1);
return;
}
/* System.Drawing.Image image;
image = System.Drawing.Image.FromStream(file1.PostedFile.InputStream);
float pic_width = image.PhysicalDimension.Width;
if ( pic_width > 690 )
{
string validate2 = @"
";
RegisterStartupScript("validatelenScript",validate2);
return;
}*/
string new_file_name = Path.GetFileName(file.get_FileName().Trim());
string member_id = "";
if (Session["Admin"]== null || Session["Admin"].ToString()== "")
{
member_id = "guest(访客)";
}
else
member_id = Session["Admin"].ToString();
// string imgpath = rec.GetCreatPath(Server.MapPath
("."),"upload/supply_image",new_file_name,member_id.Trim());
string imgpath = @Page.Server.MapPath(".")+@"\upload"+@"\"+new_file_name;
Response.Write(imgpath.Trim());
// return;
try
{
if (imgpath.Trim() == "")
{
string validate2 = @"
";
RegisterStartupScript("validatenameScript",validate2);
return;
}
string filename= imgpath;
file.SaveAs(filename);
// rec.save_file_path(ViewState["conn"].ToString().Trim
(),filename.Trim());
string validate3 = @"
";
RegisterStartupScript("showimage",validate3);
}
catch(Exception ee)
{}