I am writing file upload application in Struts 1.3.8. The problem I am
having is whenever I have file over 200MB to be upload application
doesn't work properly. I have couple of text field beside files upload
and those field value are shown null if I try to upload file over 200MB.
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 />
<label for="recipientsName" class="formLabel"><bean:message
key="transfer.recipients"/></label>
<html:textarea title="Receipient Addresses" rows="2"
styleId="recipientsName" property="recpt_name" tabindex="2" cols="75" />
<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 />
<input title="File2" type="file" name="testFile[1]" id="upload_1"
tabindex="4" size="60"/><br>
<input title="File3" type="file" name="testFile[2]" id="upload_2"
tabindex="5" size="60"/><br>
<input title="File4" type="file" name="testFile[3]" id="upload_3"
tabindex="6" size="60"/><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>
ActionForm
----------------
public class UploadForm extends org.apache.struts.action.ActionForm {
private String trans_name;
private String recpt_name;
private List testFile;
/**
*
*/
public UploadForm() {
super();
testFile = new ArrayList();
}
public FormFile getTestFile(int i){
return (testFile.size() > i) ? (FormFile)testFile.get(i) : null;
}
public List getList(){
return testFile;
}
public void setTestFile(int i, FormFile f){
if(f.getFileSize() <= 0){
f.destroy();
}else{
testFile.add(f);
}
}
public int getFileCount(){
return testFile.size();
}
public String getRecpt_name() {
return recpt_name;
}
public void setRecpt_name(String recpt_name) {
this.recpt_name = recpt_name;
}
public String getTrans_name() {
return trans_name;
}
public void setTrans_name(String trans_name) {
this.trans_name = 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();
String transactionName = getTrans_name(); // HERE I
AM GETTING NULL IF FILE SIZE IS > 200MB
String recipientName = getRecpt_name(); // FOR
BOTH transactionName and recipientName.
if(transactionName == null){
errors.add("error", new
ActionMessage("error.transactionName"));
}
if(recipientName == null){
errors.add("error", new ActionMessage("error.recipientName"));
}
return errors;
}
}
Any help will be appreciated.
Anjib
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org