%@ page import="org.apache.struts.action.*,
java.util.Iterator,
org.apache.struts.webapp.upload.UploadForm"%>
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
File Upload Example
<%
ActionErrors errors = (ActionErrors) request.getAttribute(Action.ERROR_KEY);
//note that this error is created in the validate() method of UploadForm
Iterator iterator = errors.get(UploadForm.ERROR_PROPERTY_MAX_LENGTH_EXCEEDED);
//there's only one possible error in this
ActionError error = (ActionError) iterator.next();
pageContext.setAttribute("maxlength.error", error, PageContext.REQUEST_SCOPE);
%>
Note that the maximum allowed size of an uploaded file for this application is two megabytes.
See the /WEB-INF/struts-config.xml file for this application to change it.
Please enter some text, just to demonstrate the handling of text elements as opposed to file elements:
Please select the file that you would like to upload:
If you would rather write this file to another file, please check here:
If you checked the box to write to a file, please specify the file path here: