aspose file tools*
The moose likes Servlets and the fly likes file uploads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "file uploads" Watch "file uploads" New topic
Author

file uploads

Niklas Rosencrantz
Ranch Hand

Joined: Apr 08, 2006
Posts: 49
Users can upload files to my server's file system via my web app. An uploaded file gets an id from the database. Since all uploads go to the same directory, could there be problems with storing many uploads in the same directory (on linux)? Should I create some subdirectory structure and store subsets of the files in subdirectories instead? If I set up y subdirectories then the program can put a file in subdirectory x if x is remainder of the file id after division with y. e.g. if I keep 100 subdirectories:

If so, what's a future-proof value for y? 10? 100? 1000?

Thanks in advance
Niklas
Wilson Gordon
Ranch Hand

Joined: Apr 07, 2007
Posts: 89
It's not a problem to store all the files in one directory. However, to make it easier for yourself, such as when backing up the files, it's a good idea to store each user's files in its own directory (ex. using the user ID as directory name).
Niklas Rosencrantz
Ranch Hand

Joined: Apr 08, 2006
Posts: 49
No problem then. Thanks a lot Wilson.
[ May 20, 2007: Message edited by: Niklas Rosencrantz ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61209
    
  66

Originally posted by Wilson Gordon:
It's not a problem to store all the files in one directory.


I'm not so sure about that. There is a limit to the number of files that can be stored in a single folder.

Since this is much more about UNIX file storage techniques than servlets, I've moved it to the UNIX forum for further discussion.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: file uploads