The request i think. This is some code where I grab the FileUpload information:
public boolean getFormFileData(ActionForm form, HttpServletRequest request) { InputStream stream, instream; if (form instanceof UploadForm) { System.out.println("\n===> you are in getFormFileData"); UploadForm theForm = (UploadForm) form; //retrieve the text data String theText = theForm.getTheText(); //retrieve the file representation FormFile file = theForm.getTheFile(); //retrieve the file name String fileName= file.getFileName(); //retrieve the content type String contentType = file.getContentType(); boolean writeFile = theForm.getWriteFile(); //retrieve the file size String size = (file.getFileSize() + " bytes"); // the file path on file system where the file is saved to String filePath = theForm.getFilePath(); String data = null; try { //retrieve the file data ByteArrayOutputStream baos = new ByteArrayOutputStream(); stream = file.getInputStream(); if (!writeFile) { //only write files out that are less than 4MB if (file.getFileSize() < (4*1024000)) { int strmdata; while ((strmdata = stream.read()) != -1) baos.write(strmdata); request.setAttribute("binaryData", baos.toByteArray()); } else { data = new String("The file is greater than 4MB, " + " and has not been written to stream." + " File Size: " + file.getFileSize() + " bytes. This is a" + " limitation of this particular web application, hard-coded" + " in com.dsrs.upload.UploadAction"); } } else { //write the file to the file specified OutputStream bos = new FileOutputStream(theForm.getFilePath()); int bytesRead = 0; byte[] buffer = new byte[8192]; while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) { bos.write(buffer, 0, bytesRead); } bos.close(); data = "The file has been written to \"" + theForm.getFilePath() + "\""; } //close the stream stream.close(); } catch (FileNotFoundException fnfe) { return false; } catch (IOException ioe) { return false; } //place the data into the request for retrieval from display.jsp request.setAttribute("text", theText); request.setAttribute("fileName", fileName); request.setAttribute("contentType", contentType); request.setAttribute("size", size); request.setAttribute("data", data); request.setAttribute("filePath", filePath); //destroy the temporary file created // file.destroy(); //return a forward to display.jsp System.out.println("\n==> returning true from getFormFileData()"); return true; } // END if (form instanceof UploadForm) { else return false; } // end getFormFileData () --- "Domen, Ken" <[EMAIL PROTECTED]> wrote: > Thanks-- adding the "enctype-multipart/form-data" > did make it work. > I'm just not sure where the actual uploaded doc > goes. Does anyone know? > > ken > > -----Original Message----- > From: Bryant, Doug [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 09, 2002 8:01 AM > To: 'Struts Users Mailing List' > Subject: RE: upload fails > > > make sure your form tag sets the encoding type to > multi-part > > <html:form action="/saveReferences.do" > enctype="multipart/form-data"> > > > Hope this helps. > > Doug > > -----Original Message----- > From: SCHACHTER,MICHAEL (HP-NewJersey,ex2) > [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 09, 2002 10:58 AM > To: 'Struts Users Mailing List' > Subject: RE: upload fails > > > Ken, > > Do you have a corresponding ActionForm containing > these methods: > > public FormFile getFormFile(); > public void setFormFile(FormFile file); > > -----Original Message----- > From: Domen, Ken [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 08, 2002 12:20 PM > To: '[EMAIL PROTECTED]' > Subject: upload fails > > > I'm trying to do a simple file upload and my jsp has > this snippet: > > <html:file property="formFile"/><br> > <html:submit /> > > When I submit, I get the error: > IllegalArgumentException: Argument Type Mismatch > > Am I missing something? > > thanks. > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>