Attaching documents to a questionnaire


Documents, images, media, and any file types can be attached to a questionnaire by uploading them from the respondent's computer, and can be retrieved using a Data report.

Creating a question to upload the attachment

To allow a questionnaire to upload a document, create a question and choose the Upload question style:

In the allowed extensions field, enter a list of the document extensions allowed, such as xls,xlsx,doc,docx separated by commas.
In the maximum file size field, enter the largest document size allowed.
Both of these parameters are important to prevent upload denial of service attacks.

Respondent experience

These parameters will create a question that looks like this:

Upload question

The respondent uses the Browse button to find the worksheet, and then presses Upload. The document is uploaded, and the respondent sees a confirmation message:

The respondent can then can proceed to the next page of the questionnaire.

Retrieving the data

When a document is uploaded, a unique identifying number is assigned to it. The original file name and the unique number are stored in the Upload question's field in the database. When the questionnaire data is retrieved using a Data report, responses that have an attached document include a clickable link with the original file name:

Clicking on the Attachment link will cause the document to be downloaded from the server and loaded with the application that is registered for that document's MIME type, such as Excel or Word.

Technical information

As of release 7, ViewsFlash stores uploaded documents in the database by default, and no additional servlet parameters are needed.
To override this and to store documents in the file system as previous releases did, the system Administrator must include upload.method=file in the ViewsFlash servlet parameters. If a database is not being used, documents are also stored in the file system.

When upgrading from previous releases, including the upload.method=file servlet parameter will preserve the legacy behavior. If the parameter is omitted, all the documents saved in the file system will be migrated automatically to the database the first time that the application starts; note that the application might take a relatively long time to start.

The servlet parameter "upload.maxsize" limits the size of the largest document that can be uploaded. The default value is 1 million bytes.

If not using a database, the system Administrator must include the servlet parameter "". If it is not specified,it defaults to /etc/cogix/upload. The parameter must point to a directory where the ViewsFlash application server has been granted file creation, directory creation, and read, write and delete access rights. In a single-server deployment, any directory can be used. In a clustered deployment, this directory must reside on a shared volume, so that attachments gathered from all servers are stored in the same directory and can be accessed by all nodes in the cluster.

Uploaded files are stored in subdirectories named SSS!PPP, where SSS is the Place name and PPP is the questionnaire name.
The files are saved using names RRRRR.ext, where RRR is a random number and .ext is the original file extension.
The generated file name and the original file name are written to the Upload question's field in the database.


Next: Branching