Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

downloading files from database

 
J Das
Ranch Hand
Posts: 83
Firefox Browser Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone.. I have a question regarding file downloading. I am developing a file sharing website where users can upload and download files.. while i have finished the uploading part, i am a bit worried with the downloading part.. while uploading , i passed the file path to database when the uploading of a file occurs.. now how can i download a file using just the path in the database ? i mean there isn't the actual file in the database but just the file path.. i hope you all are getting my question.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Write a servlet that reads the file path from the database, opens the file, and streams the contents as the response after setting the appropriate content headers.
 
Ram Narayan.M
Ranch Hand
Posts: 247
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To speed up the file path information retrieval, why could'nt you try storing these information in Apache Lucene Indexing?... When no. of file increases per user, searching for file path information takes more time... You can give a try using Apache Lucene..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before adopting something like Lucene, there's have to be a clear and demonstrable use case for it. We have seen nothing in this thread that indicates that looking up the file path is any performance burden whatsoever or that search indexing is even called for.
 
Tim Moores
Bartender
Posts: 2686
36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree with Bear. While Lucene can store non-indexed binary data (like files), that's not what it's meant for, and it's very unlikely to be more efficient at that than using the file system. There might be a case for using Lucene for storing file meta data and the file path -it would indeed be very useful for indexing the file contents, if that's part of the site- but not for storing entire files.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic