Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Grabbing path to uploaded file...

Quote Reply
Grabbing path to uploaded file...
I'm trying to work out some code that will grab the relative path of an uploaded image for a certain ID. I have the links ID, but just need a way to work out the relative path of the file. I wish it was easy, like a single line of code, but I just can't work it out :( I've looked in admin/Links/User/Jump.pm, around;

Code:
if ($col) {
my $fh;
eval { $fh = $db->file_info( $col, $id ); };
if ( $fh ) {
if ($IN->param('v') or $IN->param('view')) { # Viewing
print $IN->header(
'-type' => $fh->File_MimeType,
'-Content-Length' => $fh->File_Size,
'-Content-Disposition' => \("inline; filename=" . $IN->escape($fh->File_Name))
);
}
else { # Downloading
print $IN->header(
'-type' => 'application/download',
'-Content-Length' => $fh->File_Size,
'-Content-Transfer-Encoding' => 'binary',
'-Content-Disposition' => \("attachment; filename=" . $IN->escape($fh->File_Name))
);
}
binmode $fh;
while (read ($fh, my $buffer, 65536)) {
print $buffer;
}
return 1;
}
else {
require Links::SiteHTML;
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('FILE_UNKNOWN', $id) });
return;
}
}

...but just can't seem to work out how that would grab a certain ID's uploaded image field Frown

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Grabbing path to uploaded file... In reply to
Hi,

Check the docs in GT->SQL->File for how it works.


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.