就是上传图片。过一段时间就看到不到是什么原因呢。
string uname = string.Empty;
SUser user = new SUser();
if(user.Find(Convert.ToInt64(Request.Cookies["vvLogID"].Value)))
{
uname = user.TrueName;
}
UpLoadHelper uh = new UpLoadHelper();
UpLoadFile file = uh.GetUploadFile("file1");
string path = Path.Combine(Server.MapPath("../"),"UploadFile");
if(file!=null)
{
string ImgName = System.Guid.NewGuid ().ToString ().Replace ("-","") + Path.GetFileName(file.FileName).Substring (Path.GetFileName(file.FileName).LastIndexOf ("."));
file.SaveAs(Path.Combine(path,ImgName));
GroupsPhoto photo = new GroupsPhoto();
photo.gid = groupid;
photo.PhotoName = ImgName;
photo.PhotoHeight = 0;
photo.PhotoWidth = 0;
photo.UserID = Convert.ToInt64(Request.Cookies["vvLogID"].Value);
photo.UserName = uname;
photo.PhotoMemo = txtMemo.Text;
photo.Update();
txtMemo.Text = string.Empty; string PID = string.Empty;
SqlDataReader dr = GroupsPhoto.GroupsPhoto_sel_All();
if(dr.Read())
{
PID = dr["id"].ToString();
}
dr.Close();