Thanks a lot friend for ur detailed explanation, But the problem is DownloadAction came with struts 1.2 and i am using 1.1 :( And i am saving the file in databse as blob. I can get content using resultset.getblob("file") but what after that ? How can i transfer this to my formbean's file field ??
On 10/25/06, Ed Griebel <[EMAIL PROTECTED]> wrote:
What I have done in this situation is - obtain a list of valid files and create an identifier or "token" for each one (usually as simple as the name of the file) corresponding with the identifier expected in the action described below - throw the list of files into a List in the request/session/formbean - iterate thru this list in the jsp, displaying a hyperlink for each one with <html:link> - each hyperlink points to the action below, with the file ID as a param on the hyperlink, likely with an embedded "target='_blank'" in the link so it is displayed in its own page - Extend DownloadAction and implement getStreamInfo method. The getStreamInfo method should instantiate and return a StreamInfo class that will retrieve and stream a file to the browser, setting MIME type in the header appropriately. This method will read an application-specific identifier from the form bean to know what file to serve up. In your situation, your method or StreamInfo class will likely pull the blob from the database as a byte array and set up this byte array as an InputStream. your DownloadAction superclass will automatically hand this stream to the browser. - Add an action-mapping to the action HTH, -ed On 10/25/06, Anuraag Shinde <[EMAIL PROTECTED]> wrote: > Hi, > In my application i need to allow user to upload files, View list of > uploaded files and download a specific file. > I have sucessfully configured my application to upload the file using > FormFile as type for my file field. > Now the problem is how to Get data from database and show a downloadable > link. > > There are n number of examples for file upload but none of them cover the > download part. i.e Getting file from database which is stored as blob and > display > a downloadable link on browser. > > Any suggetion will be a great help > > ----------------------------- > Thanks and Regards > Anurag Shinde. > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- ----------------------------- Thanks and Regards Anurag Shinde. Ph : 9823014942