Jacob, Did anyone ever get back to you on this? Where are you trying to get your MultiPartRequestWrapper?
In an ActionForm subclass, you can use the method: getMultipartRequestHandler() In an Action subclass, you can do pull it from above using: MultipartRequestWrapper multiWrapper = (MultipartRequestWrapper) form.getMultipartRequestHandler(); OR, if there is no ActionForm defined for your Action subclass, create a new type of MultipartRequestHandler such as: CommonsMultipartRequestHandler cmrh = new CommonsMultipartRequestHandler(); cmrh.setServlet(servlet); cmrh.handleRequest(request); HashTable h = cmrh.getFileElements(); I used CommonsMultipartRequestHandler in my example (from an old post) but any appropriate MultiPartRequestHandler subclass should work. http://www.mail-archive.com/[EMAIL PROTECTED]/msg87269.html Just remember 2 things: a) only one file can be uploaded per file input field - someone tried to list many files in one upload field and kept seeing Exceptions thrown. b) if you are not using an ActionForm, there doesn't appear to be a MultiPartRequestHandler initialized, so create a new one like #2 above. Regards, David -----Original Message----- From: Jacob Ginu [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 10:03 PM To: Struts Users Mailing List Subject: RE: File Upload Hi, This is the sample code I am using in the action.java file.I have the necessary struts file.But it says Unable to find ServletActionContext in MultipartRequestWrapper when compiled. MultipartRequestWrapper multiWrapper = (MultipartRequestWrapper) ServletActionContext.getRequest(); Enumeration e = multiWrapper.getFileNames(); while(e.hasMoreElements()) { // get the value of thisinput tag StringinputValue = (String) e.nextElement(); // get the content type StringcontentType = multiWrapper.getContentType(inputValue); // get the name of the file from the input tag StringfileName = multiWrapper.getFilesystemName(inputValue); // Get a File object forthe uploaded File File file = multiWrapper.getFile(inputValue); // If it's nullthe upload failed if(file == null) { addActionError("Error uploading: "+ multiWrapper.getFilesystemName(inputValue)); } David Friedman <[EMAIL PROTECTED]> wrote: Why won't you use the struts-upload.war from the Struts distributions? Regards, David -----Original Message----- From: Jacob Ginu [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 9:48 PM To: [EMAIL PROTECTED] Subject: reg:File Upload Hi, Can anyone send me a sample file Upload program. Regards, Ginu --------------------------------- Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------- Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]