复制代码 代码如下:
string fullName = this.FileUpload2.PostedFile.FileName;
string type = fullName.Substring(fullName.LastIndexOf('.') + 1);
if (!PhotoTypes.IsExist(type.ToLower()))
{
Bmc.CLUtility.ShowMessage(this.Page, "只能上传JPEG、JPE、GIF、BMP、PNG格式的图片!");
return;
}
string fileName ="Upload/"+ System.DateTime.Now.ToString("yyMMddhhmmss") + "." + type;
try
{
string temp = Server.MapPath("~/Spread");
this.FileUpload2.PostedFile.SaveAs(temp + "http://www.vevb.com/" + fileName);
this.Image2.ImageUrl = "~/Spread/" + fileName;
this.Image2.Visible = true;
}
catch
{
Bmc.CLUtility.ShowMessage(this.Page, "上传文件失败!");
}
复制代码 代码如下:
string fullName = this.FileUpload2.PostedFile.FileName;
string type = fullName.Substring(fullName.LastIndexOf('.') + 1);
if (!PhotoTypes.IsExist(type.ToLower()))
{
Bmc.CLUtility.ShowMessage(this.Page, "只能上传JPEG、JPE、GIF、BMP、PNG格式的图片!");
return;
}
string fileName = System.DateTime.Now.ToString("yyMMddhhmmss") + "." + type;
try
{
string temp = Server.MapPath("~/Spread/Upload");
this.FileUpload2.PostedFile.SaveAs(temp + "http://www.vevb.com/" + fileName);
this.Image2.ImageUrl = "~/Spread/Upload/" + fileName;
this.Image2.Visible = true;
}
catch
{
Bmc.CLUtility.ShowMessage(this.Page, "上传文件失败!");
}
复制代码 代码如下:
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = Context.Server.MapPath("~/BBS/")+"Upload";
Label2.Text = Context.Server.MapPath("~/BBS/Upload");
}
新闻热点
疑难解答
图片精选