Told you, we love sharing!
I had two applications that communicate with each other through web-services. There I had a requirement to send multi-part file from one application to another. After searching I came out with the following solution and thought to share: [java] import org.apache.http.entity.mime.MultipartEntity import org.apache.http.entity.mime.HttpMultipartMode import org.apache.http.entity.mime.content.InputStreamBody import org.apache.http.entity.mime.content.StringBody import groovyx.net.http.* void sendMultiPartFile(CommonsMultipartFile multipartImageFile, String cityName) { […]
Grails does not support accessing multiple file input fields with same name using params.fieldName. We need to use request.multiFileMap (available in Spring 3.0) instead of request.fileMap. The blog provides sample code to achieve this feature via Grails Filter.