This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Struts and the fly likes Storing Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Storing Files" Watch "Storing Files" New topic

Storing Files

Patrick McDonogh
Ranch Hand

Joined: Oct 13, 2005
Posts: 89
Hi there,

I have a Struts web site where users can upload files to the server hosting the site.
These files can then be downloaded by other users.

I was wondering if anyone knows the best way to store the files on the file system?
For instance is it better to store them all in one directory or multiple directories?

Does anyone know if there are any articles which would explain the best way to store and retrieve these files.

Thanks for the help.

ameya n

Joined: May 14, 2007
Posts: 17
you can store it in database as blob ......but am not sure of the best practice
Amirtharaj Chinnaraj
Ranch Hand

Joined: Sep 28, 2006
Posts: 241
hi Patrick McDonogh

you can use struts formFile for file uploading

and you can use BufferedinputStream(for the file content) for downloading

that uploaded file content

Chris Boldon
Ranch Hand

Joined: Aug 10, 2006
Posts: 190
Store it in the DB
I agree. Here's the link:
subject: Storing Files
It's not a secret anymore!