Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Uploading files and his division for line in line. Save in database*/
- @RequestMapping(value = "/upload", method = RequestMethod.POST)
- public @ResponseBody String handleFileUpload(@RequestParam("file")MultipartFile file){
- if (!file.isEmpty()) {
- try {
- byte[] bytes = file.getBytes();
- String completeData = new String(bytes);
- BufferedOutputStream stream =
- new BufferedOutputStream(new FileOutputStream(new File( "-uploaded")));
- stream.write(bytes);
- stream.close();
- /*Data for doc_add_date*/
- Calendar calendar_add_date = Calendar.getInstance();
- Timestamp doc_add_date = new Timestamp(calendar_add_date.getTime().getTime());
- /*Data for doc_mod_date*/
- Calendar calendar_mod_date = Calendar.getInstance();
- Timestamp doc_mod_date = new Timestamp(calendar_mod_date.getTime().getTime());
- /*generation UUID*/
- UUID uuid = UUID.randomUUID();
- String uuidStr = uuid.toString();
- /*Result*/
- dao.add_b_utmdocs(completeData, doc_add_date, doc_mod_date, uuidStr);
- return "redirect:/home";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement