Hello,

            I am trying to Upload a File using MultipartRequest Class, but the Directory(c:/upload) to which the File is to be Uploaded is giving problem.

The Method “dir.canWrite()” is not getting executed.The directory c:/upload exists on my PC .

 

The Code is as follows

            Calling of method in a Servlet

            MultipartRequest multi = new MultipartRequest(request,"c:/upload",1*1024*1024);

            ///         

            public MultipartRequest (HttpServletRequest request, String saveDirectory,

                          int maxPostSize) throws IOException {

            //…….

            File dir = new File (saveDirectory); 

            if (!dir.isDirectory()){

               throw new IllegalArgumentException("Not a directory: " + saveDirectory);

              }       

            if (!dir.canWrite()){    //The Execution Terminates at this point…        

               throw new IllegalArgumentException("Not writable: " + saveDirectory);

              }

            //The Execution Terminates at this point…           

            Please advice me any solution. 

Thanking you in advance

Sameer

Reply via email to