Community articleUFLExtractFile function
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Description

This function will extract an enclosure contained in a node and save it to a file on the local computer. Note that this function does not remove the enclosure from the form.

Function

   r_short UFLExtractFile(
      formNodeP aNode,
      r_charP theFile
   );


Parameters

Table 1. Function parameters
ExpressionTypeDescription
aNode formNodePThe item formNodeP that contains the enclosure.


Returns

OK on success or an error code on failure.

Example

In the following example, UFLDereferenceEx is used to locate a specific data item node. UFLExtractFile is then used to write the image data to the local drive.
   r_error exportImage(formNodeP form)
   {
   formNodeP tempNode=NULL;
 
   r_error error=OK;
      if ((tempNode = UFLDereferenceEx(form, NULL, "PAGE1.LOGODATA ", 0,
         UFL_ITEM_REFERENCE, NULL)) == NULL)
      {
         fprintf(stderr, "Could not find LOGODATA node.\n");
         return(NOTOK);
      }
 
      error = UFLExtractFile(tempNode, "logo.jpg");
      if (error != OK)
      {
         fprintf(stderr, "UFLExtractFile error %hd.\n");
         return(NOTOK);
      }
      return(OK);
   }


Parent topic:
FormNodeP functions