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.
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.
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..
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
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
0
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.