//在网上找了一个asp保存文件的实例,无法收藏,私心想着以后可能用得着 ,便粘贴过来改改用于保存图片,只用于借鉴
protected void UploadImage(Image image,string imagepath)
{
savePath = "自定义";//设置保存文件的路径
string extname = Path.GetExtension(imagepath.FileName);//获取文件类型
string filename="自定义";//设置文件名称
savePath += pilename + extname;
if (File.Exists(savePath))
{
File.Delete(savePath);//如果文件已经存在就将已存在的文件删除
}
image.SaveAs(savePath);//将用户image保存为savePath
}
}
关于图片保存
最新推荐文章于 2024-04-24 14:03:25 发布