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

Kevin Falcone falcone at bestpractical.com
Wed Jun 3 08:32:07 EDT 2009


On Jun 3, 2009, at 7:23 AM, BJ Blanchard wrote:

> 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?

Look at Download/CustomFieldValue/dhandler

You need to get an ObjectCustomFieldValue object and then fetch the  
LargeContent

-kevin

>
>
> -----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.
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com




More information about the rt-users mailing list