title: Copy file to SD Card in Cordova PhoneGap 2.1.0
body: <p>I'm trying to copy a file (picture) from the local cache directory of an application to the permanent storage for pictures on the SD card.  I tried searching and found examples of how to do this in Java, but I couldn't find an example of how to do this with Cordova PhoneGap.</p>
  
  <p>I built the following code below following the API instructions, but I don't understand how to get the path to the pictures directory.  Also my CopyTo command doesn't seem to work correctly when using a test directory.</p>
  
  <pre><code>function onCameraSuccess(uri) {
      copyFileToStorage(uri);
  }
  
  
  var fileSystem;
  var fileURI;
  function copyFileToStorage(uri) {
      fileURI = uri;
      window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onRequestFileSysSuccess, fsFail);
  }
  function onRequestFileSysSuccess(fs) {
      fileSystem = fs;
      fileSystem.root.getFile(fileURI, {create: false}, onFileEntrySuccess, fsFail);
  }
  function onFileEntrySuccess(fileEntry) {
      parentEntry = fileSystem.root.getDirectory("test", {create: true});
      fileEntry.copyTo(parentEntry, "file.copy", onCopyToSuccess, fsFail);
  }
  function onCopyToSuccess(r) {
  
  }
  function fsFail(evt) {
      console.log(evt.code);
      alert('fsFail');
  }
  </code></pre>
  
  <p>Thank you for your help!
  Jason</p>