在asp.net中上传并重命名图像 [英] Upload and rename image in asp.net

查看:82
本文介绍了在asp.net中上传并重命名图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


这是asp.net上传图片的代码!

Hi this is code for Upload image in asp.net !

UploadImgHeder.PostedFile.SaveAs(path + UploadImgHeder.FileName);



我想上次上传,重命名然后上传!

这是怎么做的?


I want Last Upload , Rename and then upload !
How do this ???

推荐答案

检查文件是否已经存在 - File.Exists会这样做 - 如果它已重命名做 - File.Move这次。然后在代码示例中执行SaveAs。
Check if the file already exists - File.Exists will do that - and rename it if it does - File.Move this time. Then do the SaveAs as on your code example.


这篇关于在asp.net中上传并重命名图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆