Is a good idea to use a GUID in name of files generated by users?

Introducing the ONLY search engine optimization software product that has been 100% PROVEN to dramatically increase your rankings in Google, Yahoo, and Bing. Get it now!

If you want better SEO, you should add something before the GUID. Better is to generate your own unique id in combination with something that explains the image/file (because of SEO).

Woww, this is a good information... – Acaz Souza Oct 2 at 18:11.

Yes. But probably a much more convenient scheme would use a hash-sum (say the MD5-sum) of the contents. That way, the generation of the filename is repeatable (in case something goes wrong, data needs to be migrated to a different server, content is shared across different intallations etc).

You'd automatically share duplicate uploads. Of course, then you'd need to track who owns the file (and not delete it untill the last usage is deleted) Note An example of a typical md5sum is 5eb63bbbe01eeed093cb22bb8f5acdc3 (for ASCII/UTF8 "hello world") Edit in response to the comments (about hash collisions): True enough, you might get hash collisions with very large sets of documents. In that case, it is most common to use the hash sum + the length of a file to identify the 'content blob'.

So you'd do something like: http://cms.mysite. Local/docs/123986/5e/b63bbbe/01eeed093cb22bb8f5acdc3. Png for a png of length ~ 123Kb.

Agree, but you will also need to watch for hash collisions. – Joel Coehoorn Oct 2 at 18:05 it's a snowball in hell's chance - but you would have to handle MD5 collisions in this case. – BrokenGlass Oct 2 at 18:06 The probability of a hash collision is so astronomically small it's really not worth worrying about.

We're talking probabilities of 10^-18 if you have ten billion documents. That's down in the "we're more likely to have an alpha particle flip bits in memory" territory. – Cameron Skinner Oct 2 at 18:10 There are other hash functions that have a lower colision rate (SHA-1 or Tiger).

Also, added a common stratgey to deal with collisions in the asnwer text – sehe Oct 2 at 18:13.

Yes, that approach is fine. It's very similar to the way that Git stores its files. If you're doing things the same way Linus Torvalds does then you're probably doing it right.

It's similar in the sense that it uses a non-human-readable unique string to identify files. Git requires the ability to reproduce the IDs, hence the use of SHA hashes, but most people do not need that. The predictability of the IDs is not the important bit here.

I agree that using a hash is probably a "better" solution, but GUIDs are cheap, practical and almost certainly suitable for the purposes of the question. – Cameron Skinner Oct 2 at 18:12 The point was that the OP asked if using GUIDs is a good idea. Yes, it is a good idea.

But don't take my word for it! Here's a widely-used system designed by a very smart guy that uses something similar to GUIDs! Note that I only mentioned the reasons for Gits use of SHA in response to your comment, not in the original answer.

You mentioned it, I responded. – Cameron Skinner Oct 2 at 18:21 @Sehe: In the context of this question they're both merely ways to generate a unique name. One is based on the file contents; one is not.

That's the only difference for the purposes of this question. – Cameron Skinner Oct 2 at 18:25.

Typically I'll first save the uploaded file to a temp file via Path. GetTempFileName, then move it to permanent storage with an appropriate name after its passed whatever checks are appropriate. See: msdn.microsoft.com/en-us/library/system.... For permanent storage, guid-based file names are fine and depending on your DB server such names can be nicely indexed as well for quick querying.

If not then using a GUID is perfectly fine. If you store the association between the name the user supplied name and the generated name then the user need never see the GUID.

No, user will not interact directly with the name of the file. – Acaz Souza Oct 2 at 18:08.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions