I've attempted to get the upload to work, but I get some inconsistencies in the getters. I get the correct filename in the filename getter, but I don't get that same filename in the file getter (it's something totally different).
Here's the code for my getters: public String getUploadFileName() { log.debug("Getting filename: " + fileName); return fileName; } public void setUploadFileName(String fileName) { log.debug("Setting filename: " + fileName); this.fileName = fileName; } public File getUpload() { log.debug("Getting file: " + upload.getName()); log.debug("Size: " + upload.length()); return upload; } public void setUpload(File upload) { log.debug("Setting file" + upload.getName()); this.upload = upload; } Any idea why I don't get the file? > Where is the uploaded file supposed to be found on the server once it is > uploaded? I'm using Jboss. I only get a temp file that doesn't contain > the content of the file I uploaded. > > Any ideas what could be going on? I have the details of my code in the > previous threads. > > Thanks, Session > > >> Thanks for the tip, it worked to get me by the errors I was having. >> >> I'm now stuck with not getting the actual file uploaded. I put logging >> in the getters and setters in my java class, though the filename field >> is fetched correctly, the actually file is not: there's a temp file that >> gets created in my >> C:\jboss-4.2.1.GA\server\default\work\jboss.web\localhost\zen.server >> directory (which is the pathname returned by the file object), but it >> only has the word import in it (not the content of the file that was >> uploaded). >> >> has anyone come across this problem before? how do I gain access to >> the uploaded file? >> >> >>> Make sure you have commons-io, commons-fileupload, and >>> commons-collections jar files in your WEB-INF/lib directory. At >>> least this worked for me. >>> >>> Thanks, >>> >>> >>> On Wed, 2007-09-12 at 19:07 -0400, Session A Mwamufiya wrote: >>>> Hi, >>>> >>>> I'm using struts 2.0.6, and I keep getting the following exception >>>> when I try to replicate the fileupload example in the showcase: >>>> >>>> Unable to load bean >>>> org.apache.struts2.dispatcher.multipart.MultiPartRequest (jakarta) >>>> - [unknown location] >>>> org.apache.struts2.config.BeanSelectionProvider$ObjectFactoryDelega >>>> te Fa ctory.create(BeanSelectionProvider.java:247) >>>> com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerB >>>> ui ld er.java:134) >>>> com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerI >>>> mp l. java:476) >>>> com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerI >>>> mp l. java:486) >>>> com.opensymphony.xwork2.inject.ContainerImpl$9.call(ContainerImpl.j >>>> av a: 517) >>>> com.opensymphony.xwork2.inject.ContainerImpl.callInContext(Containe >>>> rI mp l.java:542) >>>> com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerI >>>> mp l. java:515) >>>> org.apache.struts2.dispatcher.Dispatcher.wrapRequest(Dispatcher.jav >>>> a: 70 0) >>>> org.apache.struts2.dispatcher.FilterDispatcher.prepareDispatcherAnd >>>> Wr ap Request(FilterDispatcher.java:327) >>>> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispa >>>> tc he r.java:390) >>>> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeader >>>> Fi lt er.java:96) >>>> >>>> Here is my jsp: <s:form action="SMIGImport" method="POST" >>>> enctype="multipart/form-data"> <s:file name="upload" label="File" >>>> /> <s:submit key="importSMIGButton" method="importSMIGButtonPressed" >>>> /> </s:form> >>>> >>>> Here is my validation.xml: <validators> <field name="upload"> >>>> <field-validator type="fieldexpression"> <param >>>> name="expression"><![CDATA[upload.length() > 0]]></param> >>>> <message>File cannot be empty</message> </field-validator> </field> >>>> </validators> >>>> >>>> If I remove enctype="multipart/form-data", I get the following >>>> error: Invalid field value for field "upload". >>>> >>>> Any idea how to fix this? Does this have to do with my version of >>>> struts, or is there something that I'm missing. >>>> >>>> Thanks, Session >>>> >>>> >>>> ------------------------------------------------------------------- >>>> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For >>>> additional commands, e-mail: [EMAIL PROTECTED] >>>> >>> -- Randall Svancara System Administrator Horticulture and Landscape >>> Architecture 509-335-7093 >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] For >>> additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] For >> additional commands, e-mail: [EMAIL PROTECTED] >> >> >> > > > --------------------------------------------------------------------- To > unsubscribe, e-mail: [EMAIL PROTECTED] For additional > commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]