Media selector returns value ZERO I have a custom form for with media selector from media module. The form field is as below.

$form['image'] = array(
      '#title' =&gt; t('Image'),
      '#type' =&gt; 'media',
      '#description' =&gt; t('The uploaded image will be displayed on the page unless it is marked as "removed".'),
      '#default_value' =&gt; array('fid' =&gt; $current_image),
      '#media_options' =&gt; array(
        'global' =&gt; array(
          'types' =&gt; array(
            'image' =&gt; 'image',
          ),
          'enabledPlugins' =&gt; array(
            'upload' =&gt; 'upload',
            'media_default--media_browser_1' =&gt; 'media_default--media_browser_1',
          ),
          'schemes' =&gt; array(
            'public' =&gt; 'public',
          ),
          'file_directory' =&gt; 'subpage_banner',
          'file_extensions' =&gt; 'png gif jpg jpeg',
          'max_filesize' =&gt; '1 MB',
          'uri_scheme' =&gt; 'public',
        ),
      ),
  );


When I select an image and post the form, I get the field value as an empty array. below is the print shot of my $form_state variable.

Array
(
    [identity] =&gt; 9
    [path] =&gt; contact
    [image] =&gt; Array
        (
            [fid] =&gt; 0
        )

    [fid] =&gt; 0
    [language] =&gt; en
    [removed] =&gt; 0
    [submit] =&gt; Save
    [form_build_id] =&gt; form-zFkFCgBCHtesrAYOQrQXC3Ug_sMBg68dwgWwRE-Y2Ls
    [form_token] =&gt; i_aIpfgcwSz-7d_H0U48C5SUOkWlVAkBTz1M8yokXtg
    [form_id] =&gt; sitegeneral_settings_banner_sub_update_form
    [op] =&gt; Save
)


How do I get the selected image's fid?
Added the following code 

'#tree' =&gt; TRUE,


working charm!!

added after:

'#title' =&gt; t('Image'),
'#type' =&gt; 'media',
'#description' =&gt; t('...'),