|
|
Submitting a Form with a quot;filequot; input field
mons.CommonsMultipartResolverquot;gt;
lt;property name=quot;maxUploadSizequot; value=quot;100000quot; /gt;
lt;/beangt;
lt;bean id=quot;viewResolverquot;
class=quot;org..web.servlet.view.InternalResourceViewResolverquot;gt;
lt;property name=quot;viewClassquot;gt;
lt;valuegt;org..web.servlet.view.JstlViewlt;/valuegt;
lt;/propertygt;
lt;property name=quot;prefixquot;gt;
lt;valuegt;/WEB-INF/jsp/lt;/valuegt;
lt;/propertygt;
lt;property name=quot;suffixquot;gt;
lt;valuegt;.jsplt;/valuegt;
lt;/propertygt;
lt;/beangt;
lt;/beansgt;Any ideas? If not, does someone know how to handle file uploading in spring using a simple html form? thanks
You can use the byte[] file as a member instead of MultipartFile. If you use byte[], you can add the method in your controller.
Code:
protected void initBinder(fromServletRequest request, ServletRequestDataBinder binder) throws Exception {
binder.registerCustomEditor(String.class, new StringMultipartFileEditor());
}
I still havent found out doing the same using MultipartFile or using Spring 2 form:input tags (i need to bind the fields, so i can also validate them using form:errors)... Any ideas would help...
Does someone know if what im trying to do is possible?
It can be done using a MultipartResolver.
sp...#mvc-multipart |
|