in reply to Inserting file into a database
use strict; my $filename = "File_Name_One"; my $letter = "A"; my $filecontents = ""; open( FH, "<$filename" ) || die "unable to open $filename ($!)\n"; { local( $/ ); undef $/; $filecontents = <FH>; } close( FH ); my $firstvar = $dbh->quote($filecontents); my $secondvar = $dbh->quote($letter); my $statement = "Insert into tableOne (filename, letter) values ($fil +econtents, $letter)";
The usual caveats apply - the contents of the file need to match the definition of the column (large enough, binary vs text, etc).
-derby
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Inserting file into a database
by Anonymous Monk on Jan 10, 2003 at 13:37 UTC | |
by derby (Abbot) on Jan 10, 2003 at 13:51 UTC | |
by Anonymous Monk on Jan 13, 2003 at 13:39 UTC |