上传照片不能预览
我上传照片不能预览,部分代码是这样的。大神们帮忙看看怎么去更改呗!string uploadName = InputFile.Value;//获取待上传图片的完整路径,包括文件名
//string uploadName = InputFile.PostedFile.FileName;
string pictureName = "";//上传后的图片名,以当前时间为文件名,确保文件名没有重复
if (InputFile.Value != "")
{
int idx = uploadName.LastIndexOf(".");
string suffix = uploadName.Substring(idx);//获得上传的图片的后缀名
//pictureName = Request.Cookies["username"].Value + suffix;
pictureName = 1006102 + suffix;
}
try
{
if (uploadName != "")
{
string path = Server.MapPath("~/images/");
InputFile.PostedFile.SaveAs(path + pictureName);
//Response.Write("student/student.aspx");
Session["picid"] = path + pictureName;
}
}
catch (Exception ex)
{
Response.Write(ex);
}