Help coderanch get a
new server
by contributing to the fundraiser

anilkumar Gannavarapu

Greenhorn
+ Follow
since Oct 22, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by anilkumar Gannavarapu

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....
16 years ago
Congrats...sounds good .....
16 years ago
Hi all,
I am planning to write SCJP1.4. But I am confusing to choose 1.5 or 1.4. Please guide which is the best and will give more advantage. I have 11 months time to write Certification Exam. Awaiting for your reply.

Thanks in Advance.

Cheers,
Anilkumar.