You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Srinivasula Reddy A , Bangalore" <sr...@hcl.in> on 2007/05/24 10:42:22 UTC

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.

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

Re: Upload Utility in Struts

Posted by Antonio Petrelli <an...@gmail.com>.
2007/5/24, Srinivasula Reddy A , Bangalore <sr...@hcl.in>:
>
> 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.

People seem to hate Google for some reason... anyway:

Struts1:
http://wiki.apache.org/struts/StrutsFileUpload

Struts2:
http://struts.apache.org/2.0.6/docs/how-do-we-upload-files.html

Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Upload Utility in Struts

Posted by Sourabh Chandan <so...@interglobetechnologies.com>.
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:srinivasulaa@hcl.in]
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org