in reply to File download from BLOB

You're almost there. The BLOB out of mysql is an scalar with binary content, then after setting the proper headers like you doing on the Apache2's example. you have to print the contents of the blob you get from the DB

Replies are listed 'Best First'.
Re^2: File download from BLOB
by wolfie7873 (Novice) on Mar 25, 2011 at 15:57 UTC
    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?
      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.