ars_GetEntryBLOB(ctrl,schema,entry_id,field_id,locType,locFile)

This function retrieves an attachment from the specified schema entry. The field ID specified should be an attachment field type. The locType parameter can be used to specify whether you want the attachment returned incore (ARS::AR_LOC_BUFFER) or written to a file (ARS::AR_LOC_FILENAME). If you choose to write it to a file, you must specify the locFile parameter.

On success
returns 1 if locType == AR_LOC_FILENAME
returns a scalar buffer if locType == AR_LOC_BUFFER
On failure
Returns undef.

Example:

  ars_GetEntryBLOB($c, "00-Test", "000000000000001",
		   $fid, 
		   ARS::AR_LOC_FILENAME,
		   "/tmp/attachtest") || 
		     die ("GetEntryBLOB: $ars_errstr");

  my $a = ars_GetEntryBLOB($c, "00-Test", "000000000000001",
			   $fid, 
			   ARS::AR_LOC_BUFFER);

  die "GetEntryBLOB: $ars_errstr" if(!defined($a));
  print "blob size = ".length($a)."\n";
  open(FD, ">/tmp/attachtest2") || die "open: $!";
  print FD $a;
  close(FD);
      

A subsequent comparison of the two files /tmp/attachtest and /tmp/attachtest2 should show that they are identical.


<-- Table of Contents

Last changes to this page 9th March 1999 by jeff murphy
© J.C.Murphy, J.W.Murphy 1997 arsperl@arsperl.org