Thanks to everyone who responded. It is now working. I removed the <interceptor-ref name="fileUpload"/> - it's not needed I added method="post" to the HTML form element - I had forgotten it.
The extends="json-default" in the pacjage is needed because of one of the other actions produces a JSON response. Nick J wrote: > > Hi, I am having some trouble with Uploads in Struts 2. > Here is the action: > <package name="uploads" extends="json-default" namespace="/_uploads"> > <!-- ...other actions ...--> > <action name="imageUpload" class="uploadManager" > method="imageUpload"> > <interceptor-ref name="fileUpload"/> > <result>/upload.html</result> > </action> > </package> > > Here is the HTML form: > <form name="myForm" action="/_uploads/imageUpload" > enctype="multipart/form-data"> > <input type="file" name="imageUpload" value="Browse ..." /> > <input type="submit" /> > </form> > > Here's the appropriate part of the action class: > > public String imageUpload() { > return ActionSupport.SUCCESS; > } > > public List<Image> getImageList() { > return images; > } > > public void setImageUpload(File myImage) { > uploadedImage = myImage; > } > > public void setImageUploadContentType(String contentType) { > imageContentType = contentType; > } > > public void setImageUploadFileName(String filename) { > imageFilename = filename; > } > > I have debugger break-points in the imageUpload method, and in the setter > methods. > The execution never reaches the setters, and when it breaks in the > imageUpload method, > and I inspect the values of uploadedImage, imageContentType and > imageFilename they are all null, so the interceptor has not called the the > setters like I was expecting it to. As far as I can tell, this agrees with > all the tutorials I've read, so I'm at a loss now. If anyone has any > ideas, I'd be very greatful! > > thanks! > > > > -- View this message in context: http://www.nabble.com/Struts2-upload-tp20284756p20418321.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]