以当前时间为新的名称,谢谢
以当前时间为新的名称,谢谢
嘿嘿,刚准备给你发短信呢
我这样写的,但是不行
protected void Upload_Click(object sender, EventArgs e)
{
name = FileUpload.FileName;
string type = FileUpload.PostedFile.ContentType;
string size = FileUpload.PostedFile.ContentLength.ToString();
string newname =Convert.ToString( System.DateTime.Now);
string path = Server.MapPath("~/Images/Product/" + newname);
if (type == "image/pjpeg" || type == "image/gif" || type == "image/bmp")
{
FileUpload.SaveAs(path);
Image.ImageUrl = "~/Images/Product/" + newname;
message.Text = "上传名称:" + newname + "大小:" + size + "路径:" + path;
Labelname.Text = newname;
}
else
{
Response.Write("<script>alert('" + "上传类型仅限于gif,jpg,mbp格式图片" + "')</script>");
}
}
哪错了啊?