How do I set allowed extensions for a managed_file form field?
$form['picture']['file'] = array(
  '#type' =&gt; 'managed_file',
  '#title' =&gt; t('picture'),
  '#description' =&gt; t('Allowed extensions: gif png jpg jpeg'),
  '#default_value' =&gt; (isset($foo-&gt;picture-&gt;fid) ? $foo-&gt;picture-&gt;fid : ''),
  '#upload_location' =&gt; variable_get('picture_upload_location'),
  '#upload_validators' =&gt; array(
    'file_validate_extensions' =&gt; array('gif png jpg jpeg'),
    // Pass the maximum file size in bytes
    'file_validate_size' =&gt; array(MAX_FILE_SIZE*1024*1024),
  ),
);