且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在fileupload控件中保存两个具有相同名称的相同图像。

更新时间:2023-10-17 15:04:10

你需要考虑一些约定。对于例如添加带有日期时间戳的前缀/后缀,上传文件的用户的名称等。



请查看以下链接,了解如何执行此操作:



http://***.com/ questions / 2621535 / how-to-change-fileupload-name [ ^ ]
You need to consider some kind of convention. For e.g. add a prefix/suffix with a datetime stamp, the name of the user who uploaded the file etc.

Look at the link below on how to do that:

http://***.com/questions/2621535/how-to-change-fileupload-name[^]


与其他任何系统相同的方式:

1)附加版本号在文件扩展名之前(如果它是同一个用户)

2)将其存储在不同的文件夹中(如果它是不同的用户),这样用户只能看到自己的文件。

3)使用临时文件名存储它,并使用数据库将临时名称与真实名称交叉关联。



我使用GUID值作为存储文件名的第一个和最后一个方法以及使用GUID作为行索引的简单SQL表。
The same way you would do it for any other system:
1) Attach a version number before the file extension (if it's the same user)
2) Store it in a different folder (if it's a different user) so users only see their own files.
3) Store it using a temporary file name, and use a database to cross-correlate the temporary name to the "real" name.

I use both the first and last methods with GUID values as the stored file name and a simple SQL Table using the GUID as the row index.