title: Upload a file to a Google Drive Folder
body: <p>I have an existing File object, created during my program. How can I use the drive API to upload this to a specific folder?</p>
  
  <p>I understand it's something like this:</p>
  
  <pre><code>String folderId = "0BwwA4oUTeiV1TGRPeTVjaWRDY1E";
  File fileMetadata = new File();
  fileMetadata.setName("photo.jpg");
  fileMetadata.setParents(Collections.singletonList(folderId));
  java.io.File filePath = new java.io.File("files/photo.jpg");
  FileContent mediaContent = new FileContent("image/jpeg", filePath);
  File file = driveService.files().create(fileMetadata, mediaContent)
  .setFields("id, parents")
  .execute();
   System.out.println("File ID: " + file.getId());
  </code></pre>
  
  <p>But </p>
  
  <ul>
  <li>How do I create the driveService object </li>
  <li>How do I replicate the above
  if I want to use a File object generated in my program, not one that
  exists on my computer?</li>
  </ul>