Jon,

I don't think you need to use DiskMultipartRequestHandler directly from
your action class.  Have you looked at the example that comes with Struts?
 Look for a file called 'struts-upload.war'.

If this doesn't help let me know.  I have been able to upload files to the
server using Struts.

Hope this helps.

- Ajay


-- Original Message --

>All,
>
>I am trying to upload a file to the server using the input type file and
>setting enctype="multipart/form-data" in the form. I've tried using the
>DiskMultipartRequestHandler in my action class, but keep getting a null
>pointer exception when I call the handleRequest method. Apparently it
>happens when the tempDir is being looked up. To get round this I tried
>putting the following in my web.xml under the <servlet> entry for the struts
>action servlet:
>
>        <init-param>
>            <param-name>maxFileSize</param-name>
>            <param-value>250M</param-value>
>        </init-param>
>        <init-param>
>            <param-name>multipartClass</param-name>
>
><param-value>org.apache.struts.upload.DiskMultipartRequestHandler</param-val
>ue>
>        </init-param>
>        <init-param>
>            <param-name>tempDir</param-name>
>            <param-value>/WEB-INF/temp/</param-value>
>        </init-param>
>
>I've also tried the tempDir as /WEB-INF/temp and C:\
>
>But I still get the null pointer exception:
>
>java.lang.NullPointerException
>        at
>org.apache.struts.upload.DiskMultipartRequestHandler.retrieveTempDir(DiskMul
>tipartRequestHandler.java:207)
>        at
>org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMulti
>partRequestHandler.java:63)
>
>Any help would be greatly appreciated.
>
>Cheers,
>Jon.
>
>
>=**********************************************************
>
>If you are not the intended recipient, employee or agent responsible for
>delivering the message to the intended recipient, you are hereby notified
>that any dissemination or copying of this communication and its attachments
>is strictly prohibited.
>
>If you have received this communication and its attachments in error, please
>return the original message and attachments to the sender using the reply
>facility on e-mail.
>
>Internet communications are not secure and therefore the UCLES Group does
>not accept legal responsibility for the contents of this message.  Any
views
>or opinions presented are solely those of the author and do not necessarily
>represent those of the UCLES Group unless otherwise specifically stated.
>
>This footnote also confirms that this email message has been swept by
>MIMEsweeper for the presence of computer viruses although this does not
guarantee
>that this email is virus free.
>
>**********************************************************=
>
>

Ajay Chitre

Diligent Team, Inc.
(Where Diligent People Work as a Team)

http://www.DiligentTeam.com


Reply via email to