Community articleUFLEncloseFile function
Added by IBM contributorIBM on May 2, 2012
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.



Description

This function encloses a file in a form. The file must be accessible on the local computer. The formNodeP can refer to either a page node or an item node. If the formNodeP is a page node, the function creates a data item in that page to contain the enclosure. If the formNodeP is an item node, it must be a data item, and the function encloses the file in that node.
The file is enclosed using base64-gzip encoding.

Function

   formNodeP UFLEncloseFile(
      formNodeP aNode,
      r_charP theFile,
      r_charP mimeType,
      r_charP dataGroup,
      r_charP theIdentifier
   );


Parameters

Table 1. Function parameters
ExpressionTypeDescription
aNode formNodePThe formNodeP, which will contain the enclosure, or a page formNodeP, in which a new data item formNodeP will be created to contain the enclosure.
theFiler_charPThe path to the file on the local drive to enclose.
mimeTyper_charPThe MIME type of the file. If NULL, the library will attempt to find a suitable MIME type for the file.
dataGroupr_charPThe data group to which this file should belong. If the aNode parameter is a page node, you must provide this parameter. If the aNode parameter is an item node, use NULL to keep the current datagroup option, or provide a different value to overwrite the option.
theIdentifierr_charPThe identifier to assign to the new data item if one is created. If NULL, either the current name is used or a unique name is automatically generated for the new data item.


Returns

The item formNodeP that contains the enclosure on success or NULL on failure.

Example

In the following example, UFLEncloseFile is used to enclose the image file Male.jpg into the root node of a form.
   if ((tempNode = UFLEncloseFile(aNode, "male.jpg", NULL, NULL, "PICDATA"))
      == NULL)
   {
      fprintf(stderr, "Could not enclose image file.\n");
      return(NOTOK);
   }


Parent topic:
FormNodeP functions