title: EntityMetadataWrapperException: Invalid data value given when setting file field
body: <p>Cannot set <code>file_field</code> in <code>field_collection</code>
  Has node $order and field_collection called <code>field_blueprints</code>:</p>
  
  <pre><code>&lt;?php
  $entity_type = "field_collection_item";
  $blueprint_obj = entity_create($entity_type, array('field_name' =&gt; "field_blueprints") );
  $blueprint_obj-&gt;setHostEntity('node', $order);
  $blueprint_entity = entity_metadata_wrapper($entity_type, $blueprint_obj);
  date_default_timezone_set("UTC");
  $blueprint_entity-&gt;field_blueprint_file-&gt;file-&gt;set((array)$file);
  $blueprint_entity-&gt;field_blueprint_comment = (string) $file-&gt;filename;
  $blueprint_obj-&gt;save();
  node_save($order);
  </code></pre>
  
  <p>And this code throws error:</p>
  
  <blockquote>
    <p>EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in <code>EntityDrupalWrapper-&gt;set()</code> (line 736 of sites//all/modules/entity/includes/entity.wrapper.inc).</p>
  </blockquote>
  
  <p>I have also tried:</p>
  
  <pre><code>$blueprint_entity-&gt;field_blueprint_file-&gt;set((array)$file)
  $blueprint_entity-&gt;field_blueprint_file-&gt;set(array('fid'=&gt;$file-&gt;fid))
  </code></pre>