title: Unable to add image field in drupal 7
body: <p>Im new to drupal and right now I need to create node programmatically.</p>
  
  <p>I'm able to create a simple node. But if I incorporate it with an  image field it always failed.</p>
  
  <pre><code>$file_path = drupal_realpath('tmp/test_image.jpg');
  $file = (object) array(
      'uid' =&gt; 1,
      'uri' =&gt; $file_path,
      'filemime' =&gt; file_get_mimetype($file_path),
      'status' =&gt; 1,
  );
  $copy = file_copy($file, 'public://sites/default/files/field/image/testing/', FILE_EXISTS_RENAME);
  $node-&gt;field_image[LANGUAGE_NONE][0] = (array) $copy;
  </code></pre>
  
  <p>It always return me an error :(</p>
  
  <pre><code>The specified file could not be copied, because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions. More information is available in the system log.
  </code></pre>