title: How to set timeout for file upload using Struts2?
body: <p>I have a requirement in an application to upload any type of file. Struts2 file upload interceptor has been used but I couldn't find any straight reference in Struts documentation to set timeout to terminate the file uploading.<br/></p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
      &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
      &lt;version&gt;1.2.1&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;commons-io&lt;/groupId&gt;
      &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
      &lt;version&gt;1.3.2&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Struts constants:</p>
  
  <pre><code>&lt;constant name="struts.objectFactory" value="spring" /&gt;
      &lt;constant name="struts.devMode" value="false" /&gt;
      &lt;constant name="struts.i18n.reload" value="false" /&gt;
      &lt;constant name="struts.configuration.xml.reload" value="false" /&gt;
      &lt;constant name="struts.custom.i18n.resources"
          value="/resources/naps_messages_en,/resources/naps_label_en,/resources/naps_gpcs_err_cd" /&gt;
      &lt;constant name="struts.multipart.saveDir" value="D:/tempFile" /&gt;
      &lt;constant name="struts.multipart.maxSize" value="2000000000" /&gt;
      &lt;constant name="struts.serve.static" value="true" /&gt;
      &lt;constant name="struts.freemarker.mru.max.strong.size" value="550" /&gt;
      &lt;constant name="struts.freemarker.templatesCache" value="true" /&gt;
      &lt;constant name="struts.freemarker.templatesCache.updateDelay"
          value="1800" /&gt;
  </code></pre>
  
  <p>Apache Common utils to upload file which is being called from Struts Action</p>
  
  <pre><code>FileUtils.copyFile(fileUpload, saveFilePath);
  </code></pre>
  
  <p>Maximum allowable upload time is 5 minutes. If uploading is taking more than 5 minutes then user will get a message that timeout is occurred and file can not be uploaded due to network issue. Later user will handover such files to application owners so the such file can be uploaded manually to NAS storage.  <a href="http://struts.apache.org/docs/file-upload.html" rel="nofollow">http://struts.apache.org/docs/file-upload.html</a> <br/> <br/>
  Any possible way to do it using Struts configuration or such timeout handling should be handled outside Struts.</p>