title: java.io.IOException: Invalid file path while creating and writing in a File
body: <p>I am trying to create a file inside a directory but when the code executes it brings back the error <code>'java.io.IOException: Invalid file path'</code>. 
  And the code does create the directory called 'ServerUploads' but <strong>it does not create the file</strong>. 
  Below is a code snippet : </p>
  
  <pre><code>   public static String performUploadOperation(byte[] file, String filename)
          throws IOException {
      //creating a directory to store file.
      //creating a directory to store users
      File userDirectory = new File("C:\\ServerUploads");
      //check if directory does not exist.
      if (!userDirectory.exists()) {
          userDirectory.mkdir();
      }
  
  
          File crreate = new File(userDirectory + "\\" +  filename);
  
          if(!crreate.exists())
          crreate.createNewFile();
  
  
  
  
      try{
      //convert the bytearray retrieved to a file and upload to server folder.
     FileOutputStream fos = new FileOutputStream(crreate);
     System.out.println(fos.toString());
          //write file to directory.
          fos.write(file);
          fos.close();
      }catch(FileNotFoundException e){
          e.printStackTrace();
      }
      sucess = "600 - The file has been successfully uploaded!";
      return sucess;
  }
  </code></pre>
  
  <p>The filename being passed as argument is <strong>'upload.txt'</strong> . I am not sure why it is not working. Any help is appreciated. Thanks!.
  Please see I need the method to <code>return</code> a <code>String</code> not a <code>void</code> as I have to further <code>return</code> it to the client.</p>