Symptoms
We have an external facing Smartform with the FileAttachment control to allow the user to attach a document, when users trying to upload an attachment they getting the following error:
"SmartObject property FileData is a required property for selected method Create. FileName property must be set."
This same FileAttachment control on the same form still works fine when accessed internally. It also appears as if all other functionality is working because the user can submit the form and all other data fields are captured.
Diagnoses
FileAttachment control needs to be allowed to be used with an Anonymous Forms.
By default, users will not be able to upload or download files with the file attachment control when using a Form configured for Anonymous Access. A configuration setting is available if you do want to allow users to upload and download files using an Anonymous Access Form.
You should carefully consider and evaluate the impact of allowing file uploads and downloads with Anonymous Access Forms, since doing so may be considered a security vulnerability. User Credentials and Authentication are not required for Anonymous Access Forms and therefore any files uploaded or downloaded with such Forms could be performed by anyone that can access the Form, without having to provide credentials first.
The setting to allow file uploads and downloads on Anonymous Access Forms can be added to the web.config files for the SmartForms websites, located at the following directories respectively:
bInstall Directory]K2 blackpearlK2 smartforms Designer
bInstall Directory]K2 blackpearlK2 smartforms Runtime
Add the following setting to the <appSettings> section of the configuration files listed above:
<add key="Forms.Controls.File.AllowAnonymousAccess" value="true" /> (Applicable to the File Attachment control)
<add key="Forms.Controls.Image.AllowAnonymousAccess" value="true" /> (Applicable to the Picture and Image Attachment controls)
The value should be set to true to allow the controls to function correctly when accessed through Anonymous Access Forms. If this setting is not added or set to false, the controls will not work on Anonymous Access Forms: Errors will occur when uploading or downloading files and image thumbnails may not display. Note that this setting applies to the site as a whole and will apply to all Anonymous Access Forms. It is not possible to configure security for these controls for individual Anonymous Access Forms.
Resolution
Use instructions above to enable FileAttachment control support on an Anonymous Forms or refer to K2 documentation on FileAttachment control for the same details (see Considerations section).
Also see related community KB whih explains that file which has been uploaded via anonymus form cannot be opened from anonymous form before it has saved into a SmartObject: Anonymous Forms and Views not allowing access to File attachment before save