• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

uploading multi images by using file upload...

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am tring to upload multiple images by using struts.


Form bean:
===========
public class XMLActionForm extends ActionForm
{
private FormFile myXMLFile;
private String imagedesc;
private String cost ;
private String size;
private String imageName;
private String available;







public String getImagedesc() {
return imagedesc;
}

public void setImagedesc(String imagedesc) {
this.imagedesc = imagedesc;
}

public String getSize() {
return size;
}

public void setSize(String size) {
this.size = size;
}

public void setMyXMLFile(FormFile myFile)
{
this.myXMLFile = myFile;
}

public FormFile getMyXMLFile()
{
return myXMLFile;
}

public String getImageName() {
return imageName;
}

public void setImageName(String imageName) {
this.imageName = imageName;
}

public String getAvailable() {
return available;
}

public void setAvailable(String available) {
this.available = available;
}

public String getCost() {
return cost;
}

public void setCost(String cost) {
this.cost = cost;
}


Action:

FormFile xmlFile = xmlForm.getMyXMLFile();
FileOutputStream fileOut = null;

String contentType = xmlFile.getContentType();
String fileName = xmlFile.getFileName();
int fileSize = xmlFile.getFileSize();
byte[] fileData = xmlFile.getFileData();
String file = new String(fileData);

by using above code i am able to upload one file. But i not able to upload multiple images and along with image description. Please give some idea what are the changes i have to do in those files and is there any chance to call my action multiple times by using ajax.

my jsp code is:

<html:form action="/handleFileUpload" enctype="multipart/form-data">
<table>
<tr>
<td>Painting:</td><td><html:file property="myXMLFile"/> </td>
</tr>

<tr class="textbold">
<td>Description :</td>
<td valign="top" nowrap class="textnormal">
<div align="left"><html:textarea property="imagedesc"
rows="5" value="" cols="30" /></div>
</td>
</tr>
<tr class="textbold">
<td>Cost :</td>
<td valign="top" class="textnormal">
<html:text property="cost"></html:text>
</td>
</tr>
<tr class="textbold">
<td>Size :</td>
<td valign="top" class="textnormal">
<html:text property="size"></html:text>
</td>
</tr>

<tr class="textnormal">
<td>Available for Sale :</td>
<td>
<table width="30%" border="0" cellpadding="0" cellspacing="0">
<tr class="textnormal">
<td width="11%"><html:radio property="available" value="0"/></td>
<td width="21%">yes</td>
<td width="11%"><html:radio property="available" value="1"/></td>
<td width="77%" nowrap>no</td>
</tr>
</table>
</td>
</tr>
<tr><td><html:submit value="Submit"/> </td></tr>
</table>
</html:form>


awiting for your reply....
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ra mama,

How are you?? n where are you??

nice to meet you after a long time. call me @ 91-9884609939 immediately.
 
reply
    Bookmark Topic Watch Topic
  • New Topic