天天看点

如何将图片上传到文件夹

private string fullFileName(HtmlInputFile File,string imageFile,string imageName)//上传图片(文件夹) { string fullFileName=File.PostedFile.FileName; if(fullFileName!=""&&imageFile!=""&&imageFile!=null) { string fileName=imageName; string type=fullFileName.Substring(fullFileName.LastIndexOf(".")+1); if (type=="bmp"||type=="jpg"||type=="gif") { File.PostedFile.SaveAs(Server.MapPath(imageFile)+"//"+fileName+"."+type); return imageFile+"//"+this.fileName+"."+type; } else { Response.Write(Message.ShowAndBack("图片格式错误")); } } return ""; }