title: Getting fid of attached file in Drupal 7
body: <p>I added an additional field with a type "File" to an "article" content type. Now I need to get a <code>fid</code> of the uploaded file in <code>hook_node_view()</code>. I use for this the next code:</p>
  
  <pre><code>$my_form['fid']['#value'] = $node-&gt;field_image_svg[$node-&gt;language][0]['fid'];
  </code></pre>
  
  <p>The problem is that when I check "Include file in display" before saving a node, I get a <code>fid</code> correctly. But when I do not check, I get a warning:</p>
  
  <blockquote>
    <p>Notice: Undefined offset: 0 in testmodule_node_view() </p>
  </blockquote>
  
  <p>What's the problem? Is there way to get a <code>fid</code> of an uploaded file not depending on whether the file is displayed or not?</p>