I think you're looking to collect a piece of textual information in addition to binary data from a file. The first thing you're gonna need to be sure of is that your table is setup correctly. Presumably, you're going to need a sort of TEXT field for the address, and you're gonna need a BLOB for the binary data.
The HTML is gonna need to be setup something like this:
<form action="http://www.site.com/path/to/script.pl" method=POST ENCTY
+PE="multipart/form-data">
Address: <input type="text" name="address"><br>
File: <input type="file" name="file"><br>
<input type="submit"></form>
The Perl code is going to probably be something like this:
#!/usr/bin/perl
use strict;
use CGI;
use DBI;
my $cgi = new CGI;
my $dbh = DBI->connect("DBI:mysql:dbname:localhost","username","passwo
+rd");
my $fh = $cgi->upload('file');
my $data;
$data .= $_ while <$fh>;
my $p = $dbh->prepare("insert into `tablename` (`address`,`data`) valu
+es (?,?)");
$p->execute($cgi->param('address'), $data);
$p->finish;
$dbh->disconnect;
Although this is rather basic (and untested!!), I hope it leads to an eventual solution to your problem, of course, assuming that I am understanding it correctly :-).
Best, and good luck!
-Adam
--
By a scallop's forelocks!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.