in reply to Re: File download from BLOB
in thread File download from BLOB

OK, getting there: Here's what I've got that provides the proper download dialog:
$r->content_type('application/x-download'); $r->err_headers_out->add('Content-disposition' => ("attachment; filena +me=$filename")); my ($st,$sth) = (); $st = "SELECT bin_data FROM forms WHERE filename = '$filename'"; $sth = $dbh->prepare($st) or die "Prepare Failed! " . $st . $dbh->errs +tr(); $sth->execute() or die "Execute Failed! " . $st . $sth->errstr(); my $filedata = $sth->fetchrow(); $sth->finish(); $m->print($filedata); return;
But the PDF is un-openable upon return. Is that a transmission problem, or a db problem or what?

Replies are listed 'Best First'.
Re^3: File download from BLOB
by Eliya (Vicar) on Mar 25, 2011 at 19:33 UTC
    But the PDF is un-openable

    You haven't mentioned what platform you're on, so this is just a guess...

    Often, the issue rendering files un-openable is inadvertently having applied linefeed translations to binary formats (such as PDF).  So try using binmode on the file handle $m before writing the blob to it.