如何在不使用GUID的情况下上载具有重复名称的文件。 [英] Ways to upload files with duplicate names without using GUIDs.

查看:73
本文介绍了如何在不使用GUID的情况下上载具有重复名称的文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想上传和下载具有相同名称但内容不同的文件,但我想在不使用GUID的情况下这样做,因为这会增加我的复杂性。

所以,有没有办法做到这一点不使用GUID。

I want to upload and download files with same names but different content, but I want to do this without using GUID because it will increase my complexity.
So, is there any way of doing this without using GUIDs.

推荐答案

一个解决方案可能是在文件名中使用日期时间戳(带有您想要的日期时间格式),如:

test201406170449 。文本 ; test201406170450.txt; test201406170451.txt; ...







另一个人可能在文件名末尾使用数字,例如:

test.txt; test1.txt; test2.txt; ...



但是如果你想只保留更改的那个,你最好使用file的lastupdateDate属性来检查自上次上传以来文件是否已被更改或下载。



one solution could be using Datetime stamp(with your desired datetime format) in the file name like :
test201406170449.txt ; test201406170450.txt ;test201406170451.txt ; ...



another one could be using numbers at the end of the filename for example:
test.txt ; test1.txt ;test2.txt ; ...

But if you want to keep only changed ones you'd better use file's lastupdateDate property in order to check if the file has been changed since the last upload or download.

FileInfo fi = new FileInfo("FilePath");
        DateTime lastUpdateDate = fi.LastWriteTime;


这篇关于如何在不使用GUID的情况下上载具有重复名称的文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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