Organize. Collaborate. Succeed.
PeloLife - The Pelotonics Application Blog
top of yellow highlight
17 May - 2009

To GUID or not to GUID, that is the question

by danielzev
bottom of yellow highlight
top shadow for body

Using a GUID (Globally Unique Identifier) to rename your files

I was recently having a discussion with one of our users Aaron West about the File Storage Configuation option in Pelotonics. If you’re on Plan 1 or higher in Pelotonics, you can configure your own FTP server to store your files rather than letting us store them. Many of our customers like this feature because they’re in control of their own files. In some cases, they also have to comply with certain standards so they have to store “their files” on “their servers”. If you choose to host your own files you’ll notice that we’ve renamed them to weird names like:

“18369ffd-ea5c-4a25-99e7-065bcb971471.doc”

The name of the file is a GUID. We renamed the uploaded file to eliminate the chance of a file name collision between all of our user’s files (there is a 1 in 2128 chance of collision). Though, when someone is logged into Pelotonics and they click on one of the files, it will download as the original file name because in the Pelotonics Database, we’ve mapped the physical file name to the original file name.

Imagine this… I upload a file “daniel.jpg” then one week later someone unknowingly uploads a different file, but with the same name “daniel.jpg”. If you were to do this in a folder on your computer, it would ask you if you want to overwrite the original file. Though that doesn’t make sense in Pelotonics, so we needed to make sure that people could upload the same file name more than once. In my discussion with Aaron, he asks, “Why not just rename the file from daniel.jpg to daniel-1.jpg when there’s a name collision?” He makes a good point for the ease of readability of the file names if you have the files on your own server and you’re looking at them through an FTP client. Though on top of the complication of figuring out if there’s a file already named “daniel.jpg” in the database (or even “daniel-1.jpg”), what if someone truly wanted to save a file, “daniel-1.jpg” would we rename it to “daniel-1-1.jpg”? To me, it seems like the likelihood of a file name collision would be much higher then just using the GUID.

Popularity: 29% [?]

Post to Twitter Tweet This Post

Related Posts

No related posts.

Leave a Reply

« Back to text comment

Link to: "To GUID or not to GUID, that is the question"

If you found this page useful, consider linking to it.
Simply copy and paste the code below into your web site (Ctrl+C to copy)
It will look like this: To GUID or not to GUID, that is the question

rounded bottom for body