dcsimg
<strong><font color="red">URGENT</font></strong> How to upload images using struts?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Gopesh_Sharma
Posted On:   Saturday, November 30, 2002 07:46 PM

Hello Everyone: I am trying to upload and display an image using struts for my web application. Can anyone let me know how to accomplish this? I have been able to get and display image's file size, mime-type and file name using the following code. FormFile lFormFile = lUploadImgForm. getImage() ; String ImageFileName = lFormFile. getFileName() ; String ImageFileType = lFormFile. getContentType (); I do not know how up render image on the displayImage.jsp file. Thanks, Gopesh    More>>

Hello Everyone:

I am trying to upload and display an image using struts for my web application. Can anyone let me know how to accomplish this? I have been able to get and display image's file size, mime-type and file name using the following code.



FormFile lFormFile = lUploadImgForm. getImage() ;


String ImageFileName = lFormFile. getFileName() ;


String ImageFileType = lFormFile. getContentType ();


I do not know how up render image on the displayImage.jsp file.



Thanks,
Gopesh

   <<Less

Re: URGENT How to upload images using struts?

Posted By:   Matan_Amir  
Posted On:   Sunday, December 8, 2002 02:37 AM

1. Create a JSP page or servlet that can stream out the binary data of the image as well as the proper HTTP header for the mime-type of the image (like "Content-type:image/gif") so the browser knows how to interpret the data stream.

2. on the page you want to view the image, refer to the servlet jsp in an img tag.

You cannot put the html content AND the code that streams in the images on the same page.

Re: <strong><font color="red">URGENT</font></strong> How to upload images using struts?

Posted By:   Christopher_Koenigsberg  
Posted On:   Tuesday, December 3, 2002 01:49 PM

You don't render images on the server side. The client browser renders images!


So there should be an "img" tag somewhere, with "src" attribute pointing to the URL, of the servlet or JSP which is going to send back the bytes, out of the image file that you have on the server.

About | Sitemap | Contact