I have a user form, with a field for the user to upload an image file (their logo). In the validate hook form, I have implemented file_save_upload, which constantly returns false. I see that the file is actually saved in the right place when loading, so why does file_save_upload not work?
Form field:
$form['company_logo'] = array( '#type' => 'managed_file', '#title' => t('Company Logo'), '#description' => t('Allowed extensions: gif png jpg jpeg'), '#upload_location' => 'public://uploads/', '#upload_validators' => array( 'file_validate_extensions' => array('gif png jpg jpeg'),
Verification Key:
$file = file_save_upload( 'company_logo' , array(), 'public://uploads/', FILE_EXISTS_RENAME); if (!$file) { form_set_error('company_logo', t('Unable to access file or file is missing.')); }
valen source share