I am developing an ASP.NET website. In the website users needs to create an account and then they can upload videos of their work. Viewers can view it freely. I use html5 tag to display videos. I am using sql server database. Now where to store the videos when the user uploads it? Should I store all the videos in same folder? If yes then there can be multiple videos of same name. How to deal with that?
A solution is to embed an id in the name, one way or another.
You can prefix it like this
343-Video.mp4, 344-Video.mp4, 345-How to make a sandwich.mp4
Or you can replace the entire thing with a guid and store all information in the database.
If you go with the guid, I would personally store all the videos in the same folder out of convinience, to make retrieval as simple as possible. A problem with this is SEO, search engines love file names and they don't like IDs in the names.
To get file names, you can either make folders and name them the IDs and put the videos in there or you can make a controller that will serve the files from an id. The simplests of those is by far to have folders with IDs as the names then have the videos in there, you can also fittingly store the same video of different formats in there.
/videos/343/How to make a sandwich.mp4, /videos/343/How to make a sandwich.webm
That is if you have plenty of storage and want to use your other server, otherwise you can save a lot of server costs(Both storage and trafic) by using a service to host your videos, ie. YouTube or Vimeo