In the following code:
public static MultipartEntity buildMultiEntity(final SlingHttpServletRequest request) {
MultipartEntity multipartEntity = null;
final Map<String, RequestParameter[]> params = request.getRequestParameterMap();
if(params.containsKey("myfile")) {
multipartEntity = new MultipartEntity();
for (final Map.Entry<String, RequestParameter[]> pairs : params.entrySet()) {
final String key = pairs.getKey();
final RequestParameter[] parameterArray = pairs.getValue();
final RequestParameter param = parameterArray[0];
InputStream inputStream = null;
try {
inputStream = param.getInputStream();
} catch (IOException e) {
e.printStackTrace();
}
multipartEntity.addPart(key, new InputStreamBody(inputStream, param.getFileName()));
}
}
return multipartEntity;
}
I identify if the request has image as follow
if(params.containsKey("myfile"))
How to identify, if the request has image even if I dont know, what is the input name of the image file?