Re: [Arsperl-users] Attachment problems
Brought to you by:
jeffmurphy
|
From: Richard H. <ric...@ho...> - 2007-11-19 19:08:18
|
Tim,
=20
Have you tried using ars_MergeEntry() to add the attachments? That's what I=
do and I've never seen it fail.
=20
Good Luck!
=20
Richard.
=20
> Date: Mon, 19 Nov 2007 12:08:46 -0500> From: Tim...@re...>=
To: ars...@ar...> Subject: [Arsperl-users] Attachment problem=
s> > I am running ARSPerl 1.82 (I believe - is there a way to display or> c=
heck the version?) on a Windows 2000 server. My ARS system is version> 6.00=
.01 running on an Oracle database on Redhat Enterprise Linux (Linux> 2.4.9-=
e.57smp). I am using ARSPerl within a CGI web page to allow users> to attac=
h documents to tickets that they are creating through this web> interface. =
I am using the following snippet of code to upload the> attachment file to =
the server...> > my $root =3D 'C:\\Temp\\';> if ($upload_file1) {> $fh =3D =
$cgi->upload('upload_file1');> my ($name, $path, $suffix) =3D fileparse($up=
load_file1);> file1 =3D "$root$name";> open (OUT, ">>$file1") or die "\nCan=
't open $file1 for writing:> $!\n";> binmode $fh;> binmode OUT;> while (<$f=
h>) {> print OUT;> }> } > > This code works fine and the files upload to th=
e server into the c:\temp> directory. Then I use the following code to crea=
te the ticket and> attach the file to the ticket:> > ($entryId =3D ars_Crea=
teEntry($ctrl, $shopSchema, > $sf{"Description"}, $summary,> $sf{"Requested=
By"}, $fullName,> ...> Additional fields> ...> $sf{"Additional Requirement=
s"}, $addlreq, > $sf{"Submitter"}, $ID,> $sf{"Status"}, "Submitted")) > or =
print "\n<p>[ERROR]\tCould not add shop order due to> $ars_errstr<b><br>\n"=
;> > if ($entryId) {> if (defined($file1)) {> my $ret =3D ars_SetEntry($ctr=
l, $shopSchema, $entryId, 0, > $sf{'Document 1'}, {'file'=3D>$file1, size=
=3D>(-s $file1)});> if (!$ret) {> print "Error attaching file $file1. $ars_=
errstr<br>\n";> }> }> }> > I have read several posts that said that attempt=
ing to create the> attachment along with the original ars_CreateEntry is no=
t a good idea,> so I am using ars_SetEntry to put it on afterward.> > Here'=
s the problem -- it works sometimes, but other times the uploaded> file is =
corrupted and will not open using the Remedy client tool.> Typically we are=
uploading PDF files to attach to the tickets. When I> retrieve the file fr=
om the server's temp directory and open it, it> always works fine, but when=
I extract it from Remedy through the client> tool it is sometimes corrupt.=
It appears to be related to the file> itself as certain PDF files will sav=
e and retrieve consistently and> others will not. I haven't collected enoug=
h data to correlate it to> file size or type -- I just know it the ars_SetE=
ntry action or something> from that point forward is corrupting the file. >=
> Has anyone else encountered this situation or know of a way around it. >=
> Thanks in advance,> Tim Pittman> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> CONFIDENTIALITY NOTICE> -------------------=
---> This message, together with any attachments, may be legally privileged=
> and is confidential information intended only for the use of the> individ=
ual or entity to which it is addressed. It is exempt from> disclosure under=
applicable law including court orders. If you are not> the intended recipi=
ent, you are hereby notified that any use,> dissemination, distribution or =
copy of this message, or any attachment,> is strictly prohibited. If you ha=
ve received this message in error,> please notify the original sender and d=
elete this message, along with> any attachments, from your computer.> > ---=
----------------------------------------------------------------------> Thi=
s SF.net email is sponsored by: Microsoft> Defy all challenges. Microsoft(R=
) Visual Studio 2005.> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/=
01/> _______________________________________________> Arsperl-users mailing=
list> Ars...@ar...> https://lists.sourceforge.net/lists/listi=
nfo/arsperl-users
_________________________________________________________________
100=92s of Music vouchers to be won with MSN Music
https://www.musicmashup.co.uk=
|