ponder275
ponder275

Reputation: 935

Restricting the file type in struts2 using "allowedTypes" parameter

I have a form where the user is only allowed to upload pdf files. I use the following struts action to limit the size and file type, but only the size limit works. Any ideas on what I am missing? Thanks!

    <action name="commentAction" class = "gov.mo.dnr.rat.controller.comment.CommentAction">
        <interceptor-ref name="validUserStack">
            <param name="fileUpload.maximumSize">5242880</param>
            <param name="allowedTypes">application/pdf</param>
        </interceptor-ref>
        <result name="success" type="tiles">comment</result>
        <result name="input" type="tiles">comment</result>
    </action>           

Upvotes: 0

Views: 2160

Answers (1)

ponder275
ponder275

Reputation: 935

I found the problem. The allowedTypes should be fileUpload.allowedTypes, in this case.

Upvotes: 1

Related Questions