Using ARSperl, it would be something like this:
# Save attachment from file
my $att = ars_GetEntryBLOB( $ctrl, $form, $entryId, $fieldId,
ARS::AR_LOC_FILENAME, $file );
die "ars_GetEntryBLOB( $form, $entryId, $fieldId ): $ars_errstr\n" if
$ars_errstr;
# Create a ZIP archive, add the temporary file
my $archive = Archive::Zip->new();
my $fm = $archive->addFile( $file );
my $ret = $archive->writeToFileNamed( $zipFile );
# Store the zipped file back to the original attachment field
my $hAttachStruct = {
name => $zipFile,
size => (stat $zipFile)[7],
file => $zipFile,
};
$ret = ars_SetEntry( $ctrl, $form, $entryId, 0, $fieldId =>
$hAttachStruct );
die "ars_SetEntry( $form, $entryId, $fieldId ): $ars_errstr\n" if
$ars_errstr;
Regards,
Thilo Stapff
On 09.07.2010 15:33, Greg Donalson wrote:
Hi all,
I have a requirement that in order to send an attachment across web services,
that the attachment must be zipped first. I was wondering if there was any way
that once the user has submitted an attachment to go back in and zip the
attachment and then send it across web services? I would think that I would
have to call an API to extract the attachment and then another procedure to zip
it up. I was just wondering if anyone has done anything like this before and
if they would not mind sharing how they did it. Thanks in advance!
Greg
AR Server: 7.01
ITSM: 7.01
Mid-Tier: 7.01
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug10 www.wwrug.com ARSlist: "Where the Answers Are"
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug10 www.wwrug.com ARSlist: "Where the Answers Are"