And now, I want to insert the file in a mysql database (blob field). Here is the upload_process script:<form action="upload_process.pl" method="post" enctype="multipart/form +-data"> <input type="file" name="myfile" accept="text/*" maxlength="2097152"> <!-- hier beliebige andere Felder --> <input type="submit" value="RESSOURCE" name="action"><input type="rese +t"> </form>
And here is the insert function:... my $q = new CGI; my $file = $q->param("myfile"); binmode $file; &insertRessource( $name, $entryid, $file, $mime ); #all parameters are available
This code is working but - sadly - not correct ;) I can see blob-data in the binary field but it contains only the filename of the uploaded document (about 7 Bytes). Can anybody help me? Thanks miggel15sub insertRessource { my $name = $_[0]; my $entryid = $_[1]; my $file = $_[2]; my $mime = $_[3]; my $sth = $dbh->prepare('insert into ressource (name, entryID ,dat +a, mime) values (?,?,?,?)'); $sth->execute($name, $entryid, $file, $mime) or die $!; $sth->finish; $dbh->disconnect; }
In reply to How to manage post binary upload with mysql blob fields by miggel15
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |