Managed_file form does not show #default_value I am using managed_file in Drupal 7 for my custom module. Other than the form api and managed_file, I'm using my own custom tables for this module.

This will eventually be used on shared hosting via Dreamhost, so the requirements of using PECL extensions are probably not available at this answer suggests.

The behavior I want is when the file is uploaded by clicking the "upload" button, I at least want the image file to be a link that appears to indicate to the user that the file is uploaded. When I left the default #progress_indicator in place, the AJAX indicates it never uploads. However, this is false as I can see the file in managed_file table in the db.

I've looked through several searches for this and this is the form that I've come up and I cannot see what I'm doing wrong.

$item is the result of a database call of the previous object. Its genesis was derived from a post jaypan provided.

$form['#item'] = $item;

dpm($item); =&gt; //every attribute to the sponsor object in the database.

$uri = isset($item-&gt;logoFileID) ? fetch_name('file_managed', 'uri', 'fid', $item-&gt;logoFileID) : '';

$uri = isset($item-&gt;logoFileID) ? fetch_name('file_managed', 'uri', 'fid', $item-&gt;logoFileID) : '';
dpm($uri); =&gt; 'public://logos/myfile.gif' //to show valid return of $uri
dpm($item-logoFileID); =&gt; 'public://logos/myfile.gif'

  $form['logoFileID'] = array(
    '#title' =&gt; 'file key',
    '#type' =&gt; 'hidden',
    '#default_value' =&gt; $item-&gt;logoFileID,
    );
 $form['logo_fid'] = array(
    '#type' =&gt; 'managed_file',
    '#title' =&gt; t('Logo'),
    '#description' =&gt; t('Upload a file, allowed extensions: jpg, jpeg, png, gif'),
    '#upload_location' =&gt; 'public://logos/',
    '#progress_indicator' =&gt; 'none',
    '#default_value' =&gt; $file-&gt;uri,
    );


As I said, managed_file does save the file and returns an fid that I save with the sponsor record. The behavior I have gotten in this module is that the filename was showing in this part of a form, that when clicked in Drupal shows a popup modal of the image. My question is how do I get this back link back to appear in the form to show the user it has been uploaded?, thx sam
The value of a managed file field is a file ID, rather than its URI.

Assuming $file in your code is a file object, change the element array to:

$form['logo_fid'] = array(
  '#type' =&gt; 'managed_file',
  '#title' =&gt; t('Logo'),
  '#description' =&gt; t('Upload a file, allowed extensions: jpg, jpeg, png, gif'),
  '#upload_location' =&gt; 'public://logos/',
  '#progress_indicator' =&gt; 'none',
  '#default_value' =&gt; $file-&gt;fid,
);