I am running ARSPerl 1.82 (I believe - is there a way to display or
check 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 attach 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 = 'C:\\Temp\\';
    if ($upload_file1) {
        $fh = $cgi->upload('upload_file1');
        my ($name, $path, $suffix) = fileparse($upload_file1);
        file1 = "$root$name";
        open (OUT, ">>$file1") or die "\nCan't open $file1 for writing:
$!\n";
        binmode $fh;
        binmode OUT;
        while (<$fh>) {
            print OUT;
        }
    } 

This code works fine and the files upload to the server into the c:\temp
directory.  Then I use the following code to create the ticket and
attach the file to the ticket:

($entryId = ars_CreateEntry($ctrl, $shopSchema, 
        $sf{"Description"}, $summary,
        $sf{"Requested By"}, $fullName,
        ...
        Additional fields
        ...
        $sf{"Additional Requirements"}, $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 = ars_SetEntry($ctrl, $shopSchema, $entryId, 0, 
            $sf{'Document 1'}, {'file'=>$file1, size=>(-s $file1)});
        if (!$ret) {
            print "Error attaching file $file1. $ars_errstr<br>\n";
        }
    }
}

I have read several posts that said that attempting to create the
attachment along with the original ars_CreateEntry is not 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 from 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 save and retrieve consistently and
others will not.  I haven't collected enough data to correlate it to
file size or type -- I just know it the ars_SetEntry 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

========================================================================
CONFIDENTIALITY NOTICE
----------------------
This message, together with any attachments, may be legally privileged
and is confidential information intended only for the use of the
individual or entity to which it is addressed.  It is exempt from
disclosure under applicable law including court orders.  If you are not
the intended recipient, you are hereby notified that any use,
dissemination, distribution or copy of this message, or any attachment,
is strictly prohibited.  If you have received this message in error,
please notify the original sender and delete this message, along with
any attachments, from your computer.

-------------------------------------------------------------------------
This 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
Arsperl-users@arsperl.org
https://lists.sourceforge.net/lists/listinfo/arsperl-users

Reply via email to