c#图像名称的guid代码 [英] c# guid code for image name
本文介绍了c#图像名称的guid代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要上传图片并保存在同一名称的一个文件夹中。如何使用guid?
i want upload image and save in one folder whit same name . how to use guid for this ?
推荐答案
尝试如下
try like below
string file = "mytest.jpg";
string basePath = Server.MapPath("~/Images");
string guid = Guid.NewGuid().ToString();
var Fullpath = Path.Combine(basePath, guid);
// create directory
Directory.CreateDirectory(Fullpath);
fileupload1.SaveAs(Path.Combine(Fullpath ,guid + Path.GetExtension(file))
这篇关于c#图像名称的guid代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文