Reputation: 543
We have a asp.net website which allows users to upload files. Currently we do this by filestream. User clicks a button and we create the folder under site root> downloads > folder-idofuser > filename. Is there a better way than this. ie all files in a specific location outsite application ???. Paths are not stored in the database for access we just list the files in the relative folder on the file stream. Maybe we should do it different any advice?
They can upload as many files as they want. and presently we get about 30,000 per month. Due to our folder structure we are now experiencing slowness on the folder so we archived folders over 6 months old to a new location on the hd. Lots of files and was ok at the start but now with over 600gigs worth it a bit of a nightmare. Still leaves hundreds of thousands of folders under 1 folder.
I have read lots and lost of articles and questions im still not sure whats the best thing to do see 2 examples: Looked at https://stackoverflow.com/questions/810215/best-practice-checks-when-allowing-users-to-upload-files-to-a-web-application
and Managing user-uploaded files with an ASP.NET website and Visual Studio
Now we are planning on moving from current in house hosting to a server farm. This seems very expensive when having so many files as we do. Should we have 2 servers 1 for applications/ websites and one for files and database. or would one suffice. obviously money is a big part of the equations but, trying to get a good idea as to whats best for the pound etc. any good ones please advise. And how should we store the files and access them. should we use sub domains etc and how.
Hope the questions not to boring, thanks all in advance
Upvotes: 0
Views: 708
Reputation: 2766
Isn't it better to save the files on the server with unique names (Guid) and save the path to the database. This way you only need to query your database which is realy fast and not loop through all your files on your system. And when someone requests the file just give it to the user. This could be realy fast i think. This way you can also have a script that will run and archive your files every month or day. And set a flag in the record that it is being archived with the new path to the file. This can be done automatically every night.
Upvotes: 1