when you do
entityBuilder.addPart( "userfile[" + i + "]", new FileBody(mfile[i]));
you have already exited the for loop and i
has become equals in size to selectedImgLength
, therefore you will get a ArrayIndexOutOfBoundsException
try changing so that adding the file to the entityBuilder
within the for loop.
1
solved Multipart entity file uploading java.lang.ArrayIndexOutOfBoundsException