Code 1

Java code posted by APU
created at 06 Aug 15:08

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Public void upload(HttpServletRequest request) throws ServletException {


            MultipartHttpServletRequest mRequest = (MultipartHttpServletRequest) request;
            String next = (String) mRequest.getFileNames().next();
            MultipartFile file = mRequest.getFile(next);
            if (file == null) return;


            if (fileName != null) {
            if (fileName.endsWith(".docx") || fileName.endsWith(".pptx") 
             || fileName.endsWith(".pdf") || fileName.endsWith(".xlsx")){


            /* file upload routine*/
            }else
            throw new ServletExeption("error");
}
636 Bytes in 19 ms with coderay