Can you tell me what type of file you want to upload.

Suppose you are uploading image file.

For this, In jsp page u can put this code to upload the file
 <td><html:file  name="form name" property="image name"  /></td>

In form, there are getter and setter method of imageFile. It is FormFile
type.

In Action, You can put this code to save this image on your server

                FormFile imageFile= form.getImageFile();
                String imageFilePath = 
getServlet().getServletContext().getRealPath("/") +
                                                        
"\\common\\images\\tmp\\" +
                                                        imageFile.getFileName();
                FileOutputStream fileOutputStream = null;
                fileOutputStream = new FileOutputStream(imageFilePath);
                fileOutputStream.write(imageFile.getFileData(), 0,
imageFile.getFileData().length);
                fileOutputStream.flush();
                fileOutputStream.close();


Sourabh



-----Original Message-----
From: Srinivasula Reddy A , Bangalore [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 24, 2007 2:12 PM
To: Struts Users Mailing List
Subject: Upload Utility in Struts



Hi Struts User Community,



            I need rough Idea of how to implement upload file feature in
struts as a component.



Atleast give me some rough idea or send some urls which provides that
help.



Regards,

Sreenivasula Reddy A





DISCLAIMER:
----------------------------------------------------------------------------
-------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and
intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its
affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect
the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of
this message without the prior written consent of the author of this e-mail
is strictly prohibited. If you have
received this email in error please delete it and notify the sender
immediately. Before opening any mail and
attachments please check them for viruses and defect.

----------------------------------------------------------------------------
-------------------------------------------


+++++++++++++++++++++++++++++++++++++++++
CONFIDENTIALITY NOTICE & DISCLAIMER

The contents of this e-mail are confidential to the ordinary user of the e-mail 
address to which it was addressed and may also be privileged.  If you are not 
the addressee of this e-mail you may not copy, forward, disclose or otherwise 
use it or any part of it in any form whatsoever.  If you have received this 
e-mail in error please e-mail the sender by replying to this message. The 
recipient should check this email and any attachments for the presence of 
viruses. InterGlobe accepts no liability for any damage caused by any virus 
transmitted by this email.
+++++++++++++++++++++++++++++++++++++++++



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to