User Tools

Site Tools


blobtofile_copy_data_from_blob_field_to_file_.htm
Navigation:  Advanced Topics > Clarion Language Utilities >====== BLOBTOFILE (Copy Data from BLOB Field to File) ====== Previous pageReturn to chapter overviewNext page

BLOBTOFILE( bloblabel, filename )

blk2blue.jpg

BLOBTOFILE Copy the contents of a BLOB field to an external file.
bloblabel The fully qualified label of the BLOB field. (Example: Customer.BlobImage)
filename A string constant or variable that names the output file where the BLOB will be copied.

BLOBTOFILE is used to copy the contents of a BLOB to an external file. If the copy fails for any reason, BLOBTOFILE returns the ERRORCODE posted.

BLOBTOFILE (and FILETOBLOB) are simply binary-to-binary operations.

If you need to save images to a BLOB, and later restore them to an output file, the type of image should also be saved in the database (JPG, GIF, BMP, etc.). Using BLOBTOFILE to save to a different extension can produce unpredictable results.

To add this function to your existing applications, you need only include the CWUTIL.INC file in the Global Map section of your program:

INCLUDE('CWUTIL.INC'),ONCE

Return Data Type:     SIGNED

Example:

IF BLOBTOFILE(CUS:ImageBlob, 'imagename.jpg')  !returns an ERRORCODE if copy fails

 MESSAGE('BLOB did not copy due to the following ERRORCODE: ' & ERRORCODE())

END

See Also:

FILETOBLOB

BLOB

blobtofile_copy_data_from_blob_field_to_file_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1