When I add a FAPI managed file field to a non-entity form and upload a file when the sites/default/files directory has insufficient permissions to write I get the following message:
Notice: Undefined index: #field_name in file_managed_file_save_upload() (line 638 of /var/www/ae7/modules/file/file.module).
The problem being that on non-entity forms #field_name is not set.
This affects things like the media module, along with these other issues:
#1373046: Zen | Notice: Undefined index: #field_name in file_managed_file_save_upload() | line 630 file.module
#1218048: Notice: Undefined index: #field_name in file_managed_file_save_upload()
So either the problem is that non-entity form elements should be getting a #field_name, or other modules should not be relying on #field_name being there.
It seems like it should be the former.
I still need to check drupal 8 for the same issue.