public void init ( ) throws ServletException { // Get the name of the upload directory. String uploadDirParam = getInitParameter ( "uploadDir" ) ; if ( ! StringUtil . isEmpty ( uploadDirParam ) ) { try { URL uploadDirURL = getServletContext ( ) . getResource ( uploadDirParam ) ; uploadDir = FileUtil . toFile ( uploadDirURL ) ; } catch ( MalformedURLException e ) { throw new ServletException ( e . getMessage ( ) , e ) ; } } if ( uploadDir == null ) { uploadDir = ServletUtil . getTempDir ( getServletContext ( ) ) ; } }
This method is called by the server before the filter goes into service and here it determines the file upload directory .