struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Bohnenberger <>
Subject problem uploading a text file
Date Fri, 04 Sep 2009 18:40:20 GMT
Ok, I'm sure I must be doing something dumb here, but I can't seem to find
it. I'm have a problem uploading a simple text file... when I try to a file
named "test.txt", I get an action error message "File upload error: invalid
data." and all my file variables (see below) are null when the action method
gets called.

Here's my setup:


    <action name="BulkUpload_*" class="com.rp.db.actions.BulkUpload"
        <interceptor-ref name="basicStack"/>
        <interceptor-ref name="fileUpload">
            <param name="maximumSize">8192000</param>
        <interceptor-ref name="validation"/>
        <interceptor-ref name="workflow"/>

        <result name="input">bulkUpload.jsp</result>
        <result name="done" type="redirect">Menu_init</result>
        <result name="login" type="redirect">Login_init</result>

Relevant jsp code:

<s:form action="BulkUpload_doCommand" method="post"
    <s:file label="Bulk File" name="upload" size="45"/>
    <s:submit name="command" value="Upload File"/>
    <s:submit name="command" value="Cancel"/>

Action excerpts:
    private String uploadContentType;
    private String uploadFileName;
    private File upload;
    public void setUpload(File upload)
        this.upload = upload;
    public void setUploadFileName(String uploadFileName)
        this.uploadFileName = uploadFileName;
    public void setUploadContentType(String uploadContentType)
        this.uploadContentType = uploadContentType;

As I mentioned above, when I use this form to upload a text file named
"test.txt" I get the action error message "File upload error: invalid data."
and all my "upload..." variables are null.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message