I am able to successfully upload files using managed_file
. The file is saved in the correct directory and the record shows up in the file_managed
table.
$form['image'] = array(
'#title' => t('Image'),
'#type' => 'managed_file',
'#default_value' => (isset($foo->image->fid) ? $foo->image->fid : ''),
'#upload_location' => 'public://foo_images/'
);
But when I edit the form, it still shows the Upload
button, similar to the Create page before I have uploaded a file. How do I make the edit page look like I have already uploaded a file for that particular entity?