Hi i want to store multiple files into server .but it will not work,can any one help me .i have writen code like this
List<
String> attachmentFileName=formManagementBean.getAttachmentFileName();
List<File> attachment=(List)formManagementBean.getAttachment();
if(attachment !=null){
String filePath = getServlet().getServletContext().getRealPath("/")+ "uploadfiles";
File folder = new File(filePath);
if (!folder.exists()) {
folder.mkdir();
}
for(File file:attachment)
{
File savedFile = new File( file,filePath);
ByteArrayOutputStream arrayOutput = new ByteArrayOutputStream();
FileOutputStream fos = new FileOutputStream(savedFile);
bufferedOutput = new BufferedOutputStream(fos);
processedByte = inuputSt.read(theByte, 0, theByte.length);
do {
arrayOutput.write(theByte);
processedByte = inuputSt.read(theByte);
} while (processedByte != -1);
bufferedOutput.write(arrayOutput.toByteArray());
bufferedOutput.flush();
bufferedOutput.close();