You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jo...@noaa.gov on 2009/10/07 19:52:03 UTC
S2: multiple file upload
Hello All,
I'm having trouble getting the FileUpload interceptor (v2.0.14) to work
w/ multiple files. My form looks like this:
<s:file name="shapefile[0]" label="shapefile" />
<s:file name="shapefile[1]" label="shapefile" />
<s:file name="shapefile[2]" label="shapefile" />
<s:submit name="upload"/>
and then my Action contains:
File[] shapefile;
String[] shapefileContentType;
String[] shapefileFileName;
w/ corresponding setters:
public void setShapefile(File[] files)
public void setShapefileContentType(String[] contentTypes)
public void setShapefileName(String[] names)
problem is that Parameters interceptor is trying to set
shapefile[1]FileName. I first tried elements w/o the index like:
<s:file name="shapefile" label="shapefile" />
<s:file name="shapefile" label="shapefile" />
<s:file name="shapefile" label="shapefile" />
but then I got a single "shapefile" parameter w/o separators.
Can someone please help me w/ this?
Thanks!
--john
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: S2: multiple file upload
Posted by Tommy Pham <to...@yahoo.com>.
________________________________
From: "John.C.Cartwright@noaa.gov" <Jo...@noaa.gov>
To: user@struts.apache.org
Sent: Wed, October 7, 2009 10:52:03 AM
Subject: S2: multiple file upload
Hello All,
I'm having trouble getting the FileUpload interceptor (v2.0.14) to work
w/ multiple files. My form looks like this:
<s:file name="shapefile[0]" label="shapefile" />
<s:file name="shapefile[1]" label="shapefile" />
<s:file name="shapefile[2]" label="shapefile" />
<s:submit name="upload"/>
and then my Action contains:
File[] shapefile;
String[] shapefileContentType;
String[] shapefileFileName;
w/ corresponding setters:
public void setShapefile(File[] files)
public void setShapefileContentType(String[] contentTypes)
public void setShapefileName(String[] names)
problem is that Parameters interceptor is trying to set
shapefile[1]FileName. I first tried elements w/o the index like:
<s:file name="shapefile" label="shapefile" />
<s:file name="shapefile" label="shapefile" />
<s:file name="shapefile" label="shapefile" />
but then I got a single "shapefile" parameter w/o separators.
Can someone please help me w/ this?
Thanks!
--john
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
John,
Did you look at the doc's sample?
http://struts.apache.org/2.0.14/docs/file-upload.html#FileUpload-UploadingMultipleFiles
Regards,
Tommy
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org