enclosuresettings

Sets limits on the size and type of files that users can attach to a form.

Syntax

   <enclosuresettings>
      <maxsize>maxsize</maxsize>
      <totalsize>totalsize<totalsize>
      <mediatypes>mediatype<mediatypes>
      <uniquenames>name<uniquenames>
   </enclosuresettings>
Table 1. enclosuresettings parameters
Parameter Type Description
maxsize integer The maximum size in kilobytes of any one attachment in a form. The file size of each attachment must be less than or equal to this value. If -1 or if not present, there is no limit on maximum size.
totalsize integer The maximum size in kilobytes of all attachments in a form. The sum of the file sizes of all attachments in a form must be less than or equal to this value. If -1 or if not present, there is no limit on maximum size.
mediatype string A whitespace-delimited list of file types that can be attached to a form. The list can be MIME types, file name extensions, or a combination. You can use * as a wildcard in the MIME subtype. For example: text/* application/pdf .png .gif .jpg .jpeg The file extensions must begin with the . character, and are not case sensitive. That is, .jpg includes .JPG and all other combinations of case. If not present, all file types are allowed.
name string If set to true, all attachments in a form must have unique file names. File name comparisons are case sensitive. If false or if not present, duplicate file names are allowed.

Available in

button of type enclose, cell of type enclose, page global, form global

Example

The following example shows an enclosuresettings option that limits the size of each individual attachment to a maximum of 1 megabyte with an overall limit of 10 megabytes. Any number of files can be attached as long as the sum of their file sizes is less than 10 megabytes. Also, only PDF and plain text files can be attached.


  <button sid="enclose_button">
      <value>Enclose File</value>
      <fontinfo>
         <fontname>Helvetica</fontname>
         <size>18</size>
         <effect>bold</effect>
         <effect>italic</effect>
      </fontinfo>
      <type>enclose</type>
      <enclosuresettings>
         <maxsize>1024</maxsize>
         <totalsize>10240<totalsize>
         <mediatypes>.pdf text/*<mediatypes>
      </enclosuresettings>
   </button>

Usage details

  1. This setting does not apply to enclosures made using xforms:upload.
  2. Default: If the enclosuresettings option is not present, no limits are enforced.
  3. The uniquename setting affects only form global. It is ignored in the button item, cell item, and page global.
  4. When enclosing a file in an xfdl:data element that is not part of a data group, the xfdl:data element may already contain a file. In this case the file will be replaced by the file currently being added, therefore, the name of the file being replaced will not be considered when checking for a distinct name.
  5. When enclosing a file in an xfdl:data element that is part of a data group, the data group may already contain an xfdl:data element with the same file name. In this case the matching file will be replaced by the file currently being added. As a result, the name of the file being replaced will not be considered when checking for a distinct name.
  6. A file must pass all in-scope enclosuresettings constraints before it can be attached. For example, if a button enclosuresettings limits the file size to 1024 kilobytes, and the form global enclosuresettings limits file size to 512 kilobytes, then the maximum size of any one file that can be attached to the form is 512 kilobytes.