I've created a formular where the user can upload an image using a file field. In another formular the user is able to change the image he previous uploaded.
So far I was able that the user can upload a new picture or let the field empty and the existing image remains. My question is, how do I show the user in a nice way which file he previously uploaded with the field? Setting a #default_value (@code below) does nothing for me.
//$smallimage = fid of image
$form['smallimage'] = array(
'#type' => 'file',
'#title' => t('Image'),
'#default_value' => $smallimage,
'#description' => t('Upload a file, allowed extensions: jpg, jpeg, png, gif'),
);
Has anyone a solution/workaround without switching to managed_file?
Thank you in advance
Edit:
As seen in the answers there is no direct solution for the problem. So I've changed the type back to managed_file and gave user1 and node1 the responsibility of being the reference of my files. I'm not happy with that but it works.
file_add_usage()
-function which I need to update a managed file.