title: IMGUR file upload via PHP and cURL
body: <p>I'm trying to upload an image to IMGUR via PHP.
  This is the code:</p>
  
  <pre><code>&lt;?
  $filename = "image.jpg";
  $handle = fopen($filename, "r");
  $data = fread($handle, filesize($filename));
  
  // $data is file data
  $pvars   = array('image' =&gt; base64_encode($data), 'mykey' =&gt; IMGUR_API_KEY);
  $timeout = 30;
  $curl    = curl_init();
  
  curl_setopt($curl, CURLOPT_URL, 'http://api.imgur.com/2/upload.xml');
  curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
  curl_setopt($curl, CURLOPT_POST, 1);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curl, CURLOPT_POSTFIELDS, $pvars);
  
  $xml = curl_exec($curl);
  
  curl_close ($curl);
  </code></pre>
  
  <p>?></p>
  
  <p>This is the error message I receive:</p>
  
  <blockquote>
    <p>Warning: fopen(image.jpg) failed to open stream: No such file or directory</p>
  </blockquote>
  
  <p>I don't understand the part: $filename = "image.jpg"; 
  Where does the filename come from since it's a base64 generated string? 
  Thanks,
  Bob</p>