title: URI scheme is not "file"
body: <p>I get the exception: "URI scheme is not file"</p>
  
  <p>What I am doing is trying to get the name of a file and then save that file (from another server) onto my computer/server from within a servlet.</p>
  
  <p>I have a String called "url", from thereon here is my code:</p>
  
  <pre><code>url = Streams.asString(stream); //gets the URL from a form on a webpage
  System.out.println("This is the URL: "+url);
  URI fileUri = new URI(url);
  
  File fileFromUri = new File(fileUri);                   
  
  onlyFile = fileFromUri.getName(); 
  URL fileUrl = new URL(url);
  InputStream imageStream = fileUrl.openStream();
  String fileLoc2 = getServletContext().getRealPath("pics/"+onlyFile);
  
  File newFolder = new File(getServletContext().getRealPath("pics"));
      if(!newFolder.exists()){
          newFolder.mkdir();
      }
      IOUtils.copy(imageStream, new FileOutputStream("pics/"+onlyFile));
  } 
  </code></pre>
  
  <p>The line causing the error is this one:</p>
  
  <pre><code>File fileFromUri = new File(fileUri);                   
  </code></pre>
  
  <p>I have added the rest of the code so you can see what I am trying to do.</p>