关键代码如下:
{
//图片名称
string name = FileUpload1.FileName;
//图片大小
string size = FileUpload1.PostedFile.ContentLength.ToString();
//图片类型
string type = FileUpload1.PostedFile.ContentType;
//图片本地途径
string path = Server.MapPath("upfile\\") + name;
//图片类型 截取.以后的字符串
string tp = name.Substring(name.LastIndexOf("."));
//网络虚拟路径
string wpath = "upfile\\" + name;
//截取用于判断是否为Image
string aa = type.Substring(0, 5);
{
//详细的显示图片信息
FileUpload1.SaveAs(path);
Label1.Text = name + "<br>" + size + "<br>" + type + "<br>" + path + "<br>" + tp + "<br>" + wpath + "<br>" + aa;
//图片通过网络路径显示到Image控件中
Image1.ImageUrl = wpath;
}
else
{
Response.Write("<script>alret('文件格式有误,请上传图片格式文件!')</sctipt>");
}
}




选择表情