Downloading files using JSP
How to download attachments using JSPs Regards, Jagan. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Downloading files using JSP
Just provide a link the document, the browser will try to open it, if it can not it will pop up a message to download it. José. -Original Message- From: Jagannayakam [mailto:[EMAIL PROTECTED] Sent: Friday, August 01, 2003 4:33 PM To: Struts Users Mailing List (E-mail) Subject: Downloading files using JSP How to download attachments using JSPs Regards, Jagan. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer. Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Downloading files using JSP
What do you mean by 'attachment'? Are you talking about an email attachment or something else? -R -Original Message- From: Jagannayakam [mailto:[EMAIL PROTECTED] Sent: Friday, August 01, 2003 7:33 AM To: Struts Users Mailing List (E-mail) Subject: Downloading files using JSP How to download attachments using JSPs Regards, Jagan. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Downloading files
Hello Sean, This saves me from a lot of work.Tnanx. I just tried it and it works fine, except for the case of of images. I guess for that case I have to use ContentType(image/jpeg). Konstantina - Original Message - From: Sean Willson [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, March 15, 2002 1:59 AM Subject: Re: Downloading files Try this: // get the file extension String fileName = formFile.getFileName(); // the mime type for this file String mimeType = servlet.getServletContext().getMimeType(fileName); // if we got one set it if (null != mimeType) { response.setContentType(mimeType); } // otherwise set a default else { response.setContentType(text/plain); } // otherwise output the file ServletOutputStream os = response.getOutputStream(); os.write(formFile.getFileData()); return null; Works for us ... This way you leave it up to the container to tell you the mime type. You can also configure mime types in your web.xml deployment descriptor file. Sean Konstantina Stamopoulou wrote: Hi Alexander, This is what I did after searching the archieves. I'm a little bit confused with the mime type (shouldn't multipart/form-data work for every type of file? it doesn't work for .jsps). I think I have to search more on this one. Thanx for the reply, Konstantina -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Downloading files
Hi, for a - pdf: application/pdf - word: application/msword - excel: application/vnd.ms-excel must be returned... hope this helps Alexander Jesse -Original Message- From: Konstantina Stamopoulou [mailto:[EMAIL PROTECTED]] Sent: Donnerstag, 14. Marz 2002 08:44 To: Struts Users Mailing List Subject: Re: Downloading files Hi Alexander, This is what I did after searching the archieves. I'm a little bit confused with the mime type (shouldn't multipart/form-data work for every type of file? it doesn't work for .jsps). I think I have to search more on this one. Thanx for the reply, Konstantina - Original Message - From: Jesse Alexander (KADA 12) [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, March 14, 2002 9:30 AM Subject: RE: Downloading files Hi, write an action for the download. This can be a generic action within your app taking the filename as a parameter. In this action: - grab request.out(standard servlet-programming) - set the correct mime-type(standard servlet-programming) - read the file(standard servlet-programming) - spit it out on request.out(standard servlet-programming) - return null(to indicate that the struts-action-servlet has nothing more to do) I think in the mailing-list archive should be samples how to return a pdf or an image that might help you further. hope this helps Alexander -Original Message- From: Konstantina Stamopoulou [mailto:[EMAIL PROTECTED]] Sent: Montag, 11. Marz 2002 16:03 To: Struts Users Mailing List Subject: Downloading files Hello, I' m building an application where the user has the options to: a.Store his files on the server (upload files) b.View the directories and the files he has created on the server side. These files will be links and when the user clicks on one of the files, the file should open. Also there will be a link Download file for the file download . The first part has already been done but I have no idea how to do the second part. Any help, any reference links would be really appriciated since I have never developed something like that previously. Many thanx, Konstantina -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Downloading files
Try this: // get the file extension String fileName = formFile.getFileName(); // the mime type for this file String mimeType = servlet.getServletContext().getMimeType(fileName); // if we got one set it if (null != mimeType) { response.setContentType(mimeType); } // otherwise set a default else { response.setContentType(text/plain); } // otherwise output the file ServletOutputStream os = response.getOutputStream(); os.write(formFile.getFileData()); return null; Works for us ... This way you leave it up to the container to tell you the mime type. You can also configure mime types in your web.xml deployment descriptor file. Sean Konstantina Stamopoulou wrote: Hi Alexander, This is what I did after searching the archieves. I'm a little bit confused with the mime type (shouldn't multipart/form-data work for every type of file? it doesn't work for .jsps). I think I have to search more on this one. Thanx for the reply, Konstantina -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Downloading files
Hi, write an action for the download. This can be a generic action within your app taking the filename as a parameter. In this action: - grab request.out(standard servlet-programming) - set the correct mime-type(standard servlet-programming) - read the file(standard servlet-programming) - spit it out on request.out(standard servlet-programming) - return null(to indicate that the struts-action-servlet has nothing more to do) I think in the mailing-list archive should be samples how to return a pdf or an image that might help you further. hope this helps Alexander -Original Message- From: Konstantina Stamopoulou [mailto:[EMAIL PROTECTED]] Sent: Montag, 11. Marz 2002 16:03 To: Struts Users Mailing List Subject: Downloading files Hello, I' m building an application where the user has the options to: a.Store his files on the server (upload files) b.View the directories and the files he has created on the server side. These files will be links and when the user clicks on one of the files, the file should open. Also there will be a link Download file for the file download . The first part has already been done but I have no idea how to do the second part. Any help, any reference links would be really appriciated since I have never developed something like that previously. Many thanx, Konstantina -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Downloading files
Hi Alexander, This is what I did after searching the archieves. I'm a little bit confused with the mime type (shouldn't multipart/form-data work for every type of file? it doesn't work for .jsps). I think I have to search more on this one. Thanx for the reply, Konstantina - Original Message - From: Jesse Alexander (KADA 12) [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, March 14, 2002 9:30 AM Subject: RE: Downloading files Hi, write an action for the download. This can be a generic action within your app taking the filename as a parameter. In this action: - grab request.out(standard servlet-programming) - set the correct mime-type(standard servlet-programming) - read the file(standard servlet-programming) - spit it out on request.out(standard servlet-programming) - return null(to indicate that the struts-action-servlet has nothing more to do) I think in the mailing-list archive should be samples how to return a pdf or an image that might help you further. hope this helps Alexander -Original Message- From: Konstantina Stamopoulou [mailto:[EMAIL PROTECTED]] Sent: Montag, 11. Marz 2002 16:03 To: Struts Users Mailing List Subject: Downloading files Hello, I' m building an application where the user has the options to: a.Store his files on the server (upload files) b.View the directories and the files he has created on the server side. These files will be links and when the user clicks on one of the files, the file should open. Also there will be a link Download file for the file download . The first part has already been done but I have no idea how to do the second part. Any help, any reference links would be really appriciated since I have never developed something like that previously. Many thanx, Konstantina -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Downloading files
Hello, I' m building an application where the user has the options to: a.Store his files on the server (upload files) b.View the directories and the files he has created on the server side. These files will be links and when the user clicks on one of the files, the file should open. Also there will be a link Download file for the file download . The first part has already been done but I have no idea how to do the second part. Any help, any reference links would be really appriciated since I have never developed something like that previously. Many thanx, Konstantina
Re: Downloading files locally
I keep the file at webapps\project\download.xls level and forward it to this location. Download is automatic except for .txt file. Question is :- there is no security - anybody can download it. From: R. BIGGS [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Downloading files locally Date: Wed, 6 Mar 2002 22:04:25 -0500 Greetings, I know Struts provides the capability to upload files through the browser but does it posses this capability for downloading files? If Struts does not provide this option does anyone know of any other way to achieve this? TIA Biggs _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Downloading files locally
Security is not an issue for this application will only be used internally by our users. - Original Message - From: SUPRIYA MISRA [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 07, 2002 7:26 AM Subject: Re: Downloading files locally I keep the file at webapps\project\download.xls level and forward it to this location. Download is automatic except for .txt file. Question is :- there is no security - anybody can download it. From: R. BIGGS [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Downloading files locally Date: Wed, 6 Mar 2002 22:04:25 -0500 Greetings, I know Struts provides the capability to upload files through the browser but does it posses this capability for downloading files? If Struts does not provide this option does anyone know of any other way to achieve this? TIA Biggs _ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Downloading files locally
Greetings, I know Struts provides the capability to upload files through the browser but does it posses this capability for downloading files? If Struts does not provide this option does anyone know of any other way to achieve this? TIA Biggs
RE: Downloading files locally
You mean the ability to send a file to a users machine? Try providing a link to a file :) Scott -Original Message- From: R. BIGGS [SMTP:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 1:34 PM To: [EMAIL PROTECTED] Subject: Downloading files locally Greetings, I know Struts provides the capability to upload files through the browser but does it posses this capability for downloading files? If Struts does not provide this option does anyone know of any other way to achieve this? TIA Biggs -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Downloading files locally
What I have is a editor type of application in a browser. I wish to allow the user to save the contents of what the entered locally to their machine. - Original Message - From: Barr, Scott [IBM GSA] [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, March 06, 2002 11:08 PM Subject: RE: Downloading files locally You mean the ability to send a file to a users machine? Try providing a link to a file :) Scott -Original Message- From: R. BIGGS [SMTP:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 1:34 PM To: [EMAIL PROTECTED] Subject: Downloading files locally Greetings, I know Struts provides the capability to upload files through the browser but does it posses this capability for downloading files? If Struts does not provide this option does anyone know of any other way to achieve this? TIA Biggs -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Downloading files locally
You can use a servlet push to accomplish this. Change the content type in the response header to text and then use print.out statements to output each line of text. This is a very general explanation so I leave it up to you to research the specifics. BTW you can use this technique to output about any type of file; just change the response header content type to what you need. -Original Message- From: R. BIGGS [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 11:32 PM To: Struts Users Mailing List Subject: Re: Downloading files locally What I have is a editor type of application in a browser. I wish to allow the user to save the contents of what the entered locally to their machine. - Original Message - From: Barr, Scott [IBM GSA] [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, March 06, 2002 11:08 PM Subject: RE: Downloading files locally You mean the ability to send a file to a users machine? Try providing a link to a file :) Scott -Original Message- From: R. BIGGS [SMTP:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 1:34 PM To: [EMAIL PROTECTED] Subject: Downloading files locally Greetings, I know Struts provides the capability to upload files through the browser but does it posses this capability for downloading files? If Struts does not provide this option does anyone know of any other way to achieve this? TIA Biggs -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]