What is it that you are trying to do? Is there a reason you can't just use a
FormFile object in your form bean? That would make your life a whole lot
easier - you wouldn't have to know or care about the request wrapper, and
you wouldn't have to iterate over the uploaded fields.

Also, I'm not sure where you're getting what you're trying to use in the
code you posted. Are you trying to write a Struts app or a WebWork app?
ServletActionContext is a WebWork class, not a Struts class, and
getFileNames() and getFilesystemName() are WebWork methods as well, and not
available on the Struts MultipartRequestWrapper class.

Something is very wrong...

--
Martin Cooper


"Jacob Ginu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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]

Reply via email to