• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

File upload/download question

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am currently starting/working on a project where I am using jsp/java to upload and download files. I have found beans for the upload/download, but here's my question. Does anyone have any arguments for using a file structure storage plan as opposed to using a database to store the files that are uploaded?
I would really like to hear any arguments one way or the other.
Thanks!
--Nicole
 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it really depends on a couple of things.
First off, what is the application to run on? Windows or Unix/Linux? If you're running Unix/Linux, you'll need to take into account file and directory permissions. Depending on where you want to write the file to, does your servlet container have read-write permissions to it?
Also, do you want to have to read and write BLOBs to your db? what kind of access time is it going to take to do this.
I've only done this with writing to a file system, but I hear of a lot apps that write to a db. With a db, you'll be able to add fields to the table that hold information on the file, like owner, last date modified(last upload time). You could also add a field that locks the record, so it can be downloaded if its checked out. You could do this as well if working with a file system, but I think it would be easier to implement using a db.
So depending on what you want to do, a db might be better, but BLOBs take up a lot of space in db table, so if space is small, maybe look to straight files.
I'd like to hear if anyone has compared the access times of the two. Which would be faster? I'd think it would be the filesystem, but I could be wrong.
HTH,
/rick
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I had earlier stored the attachments in my application in a folder structure. Now the folder was dynamically created using the Java File classes an so on.
I was generating an ID ( purely for my business logic requirement ) and based on that ID I was creating a folder in the server to store the file.
If you do require I can give the small code of folder creation. I had used JspSmartUpload.
Hope this is of some help,
Regards,
Milan Doshi
 
Mo-om! You're embarassing me! Can you just read a tiny ad like a normal person?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic