Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Storing Files

 
Patrick McDonogh
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Patrick
 
ameya n
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can store it in database as blob ......but am not sure of the best practice
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

regards
amir
 
Chris Boldon
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Store it in the DB
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic