I could not figure out where and what changes I have to make.

I try with simple app with following code:

1. JSP File
-------------
<html:form styleId="uploadForm" action="/upload" focus="transactionName" method="post" enctype="multipart/form-data" > <div id="errorPlace" style="font-weight: bold; color: #b80000;" aria-labelledby="errors" aria-live="assertive"><html:errors /></div> <label for="transactionName" class="formLabel"><bean:message key="transfer.name"/></label> <html:text title="Transaction Name" styleId="transactionName" property="trans_name" tabindex="1" size="35" />
<br />

<div id="fileSection" style="width: 345px" >
<label for="upload_0" class="formLabel"><bean:message key="transfer.upload"/></label> <input title="File1" type="file" name="testFile[0]" id="upload_0" tabindex="3" size="60" /><br />
</div>
<div id="blankLine"><br /></div>

<input title="Upload File" id="submit" type="submit" name="submit" class="submitbutton" tabindex="8" value='<bean:message key="button.send" />' /><br />
</html:form>

2. struts-config.xml
---------------------------
<action-mappings>
<action input="/welcomeStruts.jsp" name="UploadForm" path="/upload" scope="request" type="com.anjib.actions.UploadAction" validate="false"/>
</action-mappings>

3. UploadAction Class
------------------------------
public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        return mapping.findForward(SUCCESS);
}

4. UploadForm Class
-----------------------------
public class UploadForm extends org.apache.struts.action.ActionForm {

    private static Log log = LogFactory.getLog("UploadForm");

    private String trans_name;
    private List testFile;

    public UploadForm() {
        super();
        testFile = new ArrayList();
    }

    public FormFile getTestFile(int i) {
        System.out.println("FormFile is: " + testFile.get(i));
        return (testFile.size() > i) ? (FormFile) testFile.get(i) : null;
    }

    public List getList() {
        System.out.println("List of files: " + testFile.toString());
        return testFile;
    }

    public void setTestFile(int i, FormFile f) {

        if (f.getFileSize() <= 0) {
            System.out.println("No file to add.");
            f.destroy();
        } else {
            System.out.println("Adding new file.");
            testFile.add(f);
        }
    }

    public int getFileCount() {
        System.out.println("Number of files: " + testFile.size());
        return testFile.size();
    }

    public String getTrans_name() {
        System.out.println("Transcation name is: " + trans_name);
        return trans_name;
    }

    public void setTrans_name(String trans_name) {
        this.trans_name = trans_name;
        System.out.println("Set transaction name as " + this.trans_name);
    }

    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return set of errors.
     */
    @Override
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();

        if (getTrans_name() == null || getTrans_name().length() < 1) {
errors.add("error", new ActionMessage("error.transactionName"));
        }

        return errors;
    }
}

Observation:
-----------------
1. I can get to blank page if try to load small file (tested up to 267MB file)
2. No response for larger file(trrie with 2.85GB file)

What am I doing wrong?

Anjib

On 12/28/2010 3:32 PM, Dave Newton wrote:
Both commons-fileupload and Tomcat usually have a maximum file upload size;
configure one or both.

Dave
  On Dec 28, 2010 2:30 PM, "Anjib Mulepati"<anji...@hotmail.com>  wrote:
I am writing an app to upload file using Struts 1.3.8.

It works fine if I upload small file. But when I try to upload
lager(>200MB) file it doesn't response correctly.
For larger file my form validation get null for all field even I have
value in it.
This is happening to all browser IE,FF and chrome.

Anjib



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to