darn! I knew I should have answered this one! -R >Dude, send me your address and I will fed-ex you a cold beer >!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! >I should have thought of that before. Thanks for your help !!!!!!!! I've >just wasted 24 hours >on this.... If I was running linux I could have ran a packet capture but >am on crappy >win 2000 box. > >--B > > >Martin Cooper wrote: > >>It's not a Struts bug, and it's not even a Struts-related problem. Any time >>you need to upload files, you must use a POST request with an 'enctype' of >>"multipart/form-data". Your form element should look like this: >> >>>enctype="multipart/form-data"> >> >>-- >>Martin Cooper >> >> >>"Bryan Hunt" wrote in message >>news:4096A71B.5040606@revoltingdigits.com... >> >> >>>Hi there list, >>>I have been trying to get the most simple file upload example working with >>>and have been receiving a strange error message that I just can't seem >>>to shake. >>> >>>Here is the basics of my action form >>>snip= >>>public class ImageUploadForm extends ActionForm { >>> // --------------------------------------------------------- >>> Instance Variables >>> /** imageFile property */ >>> protected FormFile file; >>> >>> // --------------------------------------------------------- Methods >>> >>> public ActionErrors validate( >>> ActionMapping mapping, >>> HttpServletRequest request) { >>> >>> if(file == null){ >>> System.out.println("file is empty"); >>> } >>> return null; >>> } >>> >>> public FormFile getFile() { >>> return file; >>> } >>> >>> public void setFile(FormFile file) { >>> this.file = file; >>> } >>>=snip >>> >>>Here is the basics of the action >>>snip= >>>public ActionForward execute( >>> blah) { >>> System.out.println("at least i managed to get called"); >>> throw new UnsupportedOperationException("Generated method >>>'execute(...)' not implemented."); >>> } >>>=snip >>> >>>Here is the basics from my struts config file >>>snip= >>> >>type="ie.jestate.struts.form.ImageUploadForm"> >>> >>type="org.apache.struts.upload.FormFile" /> >>> >>>>> attribute="imageUploadForm" >>> input="/form/imageUpload.jsp" >>> name="imageUploadForm" >>> path="/imageUpload" >>> type="ie.jestate.struts.action.ImageUploadAction" >>> scope="request" >>> validate="true" >>> > >>> >>path="/form/imageUpload.jsp" /> >>> >>>=snip >>> >>>Here is the jsp file >>> >>>snip= >>><%@ page language="java"%> >>><%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" >>> >>prefix="bean"%> >> >> >>><%@ taglib uri="http://jakarta.apache.org/struts/tags-html" >>> >>prefix="html"%> >> >> >>> >>> >>> JSP for imageUploadForm form >>> >>> >>> >> type="imageUploadForm" > >>> File : >>> >>> >>> >>> >>> >>>=snip >>> >>>And here is the abreviated version of the error message >>>snip= >>> >>>*exception* >>> >>>javax.servlet.ServletException: BeanUtils.populate >>>org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254) >>> >>> >>org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j >>ava:821)* >> >> >>>cause mère* >>> >>>java.lang.IllegalArgumentException: argument type mismatch >>>sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>=snip >>> >>>I have tried changing the type to text and the type to String in >>>the form and that works but use this FormFile class and everything >>>seems to go fubar. >>> >>> >>>It never even gets to call the action , instead it generates this error >>>message , >>>but the setters and getters are right and the variable is public, this >>>only happens >>>with the FormFile. All the struts stuff is in my classpath as is >>>commons-fileupload-1.0.jar. >>> >>>Anyone got any idea what the hell I'm doing wrong ... I'm starting to >>>suspect this >>>could be a struts bug cause everything looks straightforward enough. >>> >>>--B >>> >> >> >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org >>For additional commands, e-mail: user-help@struts.apache.org >> >> > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org >For additional commands, e-mail: user-help@struts.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org