Search code examples
javajspfile-uploadstruts2

Unable to find 'struts.multipart.saveDir' property setting. Defaulting to javax.servlet.context.tempdir


While trying to upload the Image in struts2 the image is not uploading and showing following msg Unable to find struts.multipart.saveDir property setting. Defaulting to javax.servlet.context.tempdir

How to solve this problem


Solution

  • You need to specify

    struts.multipart.saveDir=
    

    property in either struts.xml file as a constant entry or you need to specify that in struts.properties file choice is all yours.

    struts.multipart.saveDir - The directory where the uploaded files will be placed. If this property is not set it defaults to javax.servlet.context.tempdir.
    

    this is the case with your post since you have not specified the location by yourself so struts2 is picking up the temp location for file upload.

    here is the link defining the details File Upload

    edit in struts.xml

    <struts>
        <constant name="struts.multipart.saveDir" value="location of your choice" />
        ...
    </struts>