[rt-users] Storing custom field file to local file system

BJ Blanchard blabj at dainty.ca
Wed Jun 3 07:23:00 EDT 2009


Thanks Tom - but actually my custom field IS defined as "Upload one
file" (or an attachment).

My problem is saving that attachment from RT to /tmp (for manipulation
from command-line script).

There must be some non-http method of extracting the attachment to a
file?

-----Original Message-----
From: Tom Lahti <toml at bitstatement.net>
To: BJ Blanchard <blabj at dainty.ca>
Cc: RT-Users at lists.bestpractical.com
Subject: Re: [rt-users] Storing custom field file to local file system
Date: Tue, 02 Jun 2009 13:42:07 -0700


>   my $url = RT->Config->Get('WebPath') .
> "/Download/CustomFieldValue/".$cf->Id.'/'.$cf->Content;
>   getstore($url,"/tmp/temp.odt");
>
> Or perhaps more easily put:  How do you extract a file from a custom
> field and store it on the local file system?

Since the custom field just names the file, set up a separate name space in
your web server (Apache?) that doesn't go through RT to fetch the document
through with getstore().

my $url = "http://not-rt.server.com/some/dir/" . $cf->Content;
getstore($url...);

If you need to secure it better make sure not-rt.server.com isn't publicly
available, or use "localhost" and clamp that down in Apache config, or whatever.

If you need RT to authenticate document access, then you're better off
storing the document as an attachment.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090603/d7ce7513/attachment.htm>


More information about the rt-users mailing list