I have an upload
action that receives a file from a form on a view. Validation is done when the file is uploaded.
If the file is not valid, the view is shown again and the input type="file"
value should be pointing to the file which the upload failed for.
This doesn't seem to work: (code from the view)
<input type="file" name="opt" value="${params.opt}" />
This is rendered to the user:
<input type="file" name="opt" value="org.springframework.web.multipart.commons.CommonsMultipartFile@c9b839">
Any ideas?
It seems this is not possible due security reasons, the thing is a server can access client files that might contain private info, if the server knows the path.
More info: How to set a value to a file input in HTML?
I might need to ask the user to select the file again, or do something like AJAX file upload: http://blog.teamtreehouse.com/uploading-files-ajax