Filepublic class File extends UIBean
Renders an HTML file input element.
Examples
<s:file name="anUploadFile" accept="text/*" />
<s:file name="anohterUploadFIle" accept="text/html,text/plain" />
|
Fields Summary |
---|
private static final Log | log | public static final String | TEMPLATE | protected String | accept | protected String | size |
Methods Summary |
---|
public void | evaluateParams()
super.evaluateParams();
Form form = (Form) findAncestor(Form.class);
if (form != null) {
String encType = (String) form.getParameters().get("enctype");
if (!"multipart/form-data".equals(encType)) {
// uh oh, this isn't good! Let's warn the developer
log.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to enctype 'multipart/form-data'. This is probably an error!");
}
String method = (String) form.getParameters().get("method");
if (!"post".equalsIgnoreCase(method)) {
// uh oh, this isn't good! Let's warn the developer
log.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to method 'POST'. This is probably an error!");
}
}
if (accept != null) {
addParameter("accept", findString(accept));
}
if (size != null) {
addParameter("size", findString(size));
}
| protected java.lang.String | getDefaultTemplate()
return TEMPLATE;
| public void | setAccept(java.lang.String accept)
this.accept = accept;
| public void | setSize(java.lang.String size)
this.size = size;
|
|