Reputation: 431
In my Grails application there is a feature to upload some files.
When I don't choose anything to upload, the value of params
in the controller's method is:
params:[fileupload:org.springframework.web.multipart.commons.CommonsMultipartFile@44c1e51d]
The value of request.getMultiFileMap().fileupload.isEmpty()
is also false
.
Why is fileupload
filled when I didn't choose anything to upload?
Here is my view .gsp code:
<g:form url="[resource:adsInstance, action:'save']" enctype='multipart/form-data'>
<input class="inputFiles" type="file" name="fileupload" multiple="multiple" accept="image/*" />
</g:form>
Upvotes: 0
Views: 741
Reputation: 4373
Use request.getFile('fileupload').isEmpty()
instead of request.getMultiFileMap().fileupload.isEmpty()
Upvotes: 2