title: Obtain path to file with filename
body: <p>I am writing an Android app and I need to do something I would consider incredibly simple, yet am having the hardest time figuring out.</p>
  
  <p>How can I obtain the path to a JPG file so that I can upload it to a server?</p>
  
  <p>The file is <code>snoopy.jpg</code> and is in the <code>res/drawable</code> folder</p>
  
  <p>I've tried:</p>
  
  <pre><code>    File sourceFile = new File("android.resource://com.appname.something/drawable/snoopy");
  </code></pre>
  
  <p>But, that's not a file</p>
  
  <p>I've tried:</p>
  
  <pre><code>    File sourceFile = new File("drawable/snoopy");
  </code></pre>
  
  <p>and that doesn't work.</p>
  
  <p>I tried putting snoopy.jpg in the root of the app directory and attempting:</p>
  
  <pre><code>    File sourceFile = new File("/snoopy.jpg");
  </code></pre>
  
  <p>And that still didn't work.</p>
  
  <p>Any help would be greatly appreciated!</p>