Skip to content

Commit

Permalink
Java code is added
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravishanker Kusuma committed Sep 7, 2015
1 parent 20f2124 commit 6570015
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions java/FileUploadController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import java.util.Iterator;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

@Controller
public class FileUploadController {

@RequestMapping(value="/upload", method=RequestMethod.POST)
public String handleFileUpload(MultipartHttpServletRequest request){
Iterator<String> iterator = request.getFileNames();

while (iterator.hasNext()) {
String fileName = iterator.next();
MultipartFile multipartFile = request.getFile(fileName);
byte[] file = multipartFile.getBytes();

// do stuff...

}

// do stuff...

}
}

0 comments on commit 6570015

Please sign in to comment.