in reply to unicode file in mysql
#/usr/bin/perl -w use strict; use CGI; use DBI; #start our CGI object up my $Q = CGI->new(); #we probably want to set $CGI::POST_MAX, too. #initialize a DB handle my $dsn = 'username:host:password'; #see perldocs for exact form my $DBH = DBI->new( $dsn ); #check for a file my $file = $Q->param( 'uploaded_file' ); unless ( $file ) { #there is no file upload, so here's the form to do the upload print $Q->header(), $Q->start_html(), $Q->start_form(); print $Q->filefield( -name => 'uploaded_file' ); print $Q->end_html(); exit; } my $text = join( '', <$filename> ); #slurp the whole file up $DBH->do("INSERT INTO table VALUES( '$text' )"); #assumes blob or unic +ode text field in target table #status back to user print $Q->header(), $Q->start_hmtl, $Q->p( 'Done' ), $Q->end_html;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: unicode file in mysql
by coeur2v (Initiate) on Aug 21, 2001 at 01:18 UTC | |
by mirod (Canon) on Aug 21, 2001 at 14:20 UTC | |
by coeur2v (Initiate) on Aug 21, 2001 at 19:40 UTC | |
by mirod (Canon) on Aug 21, 2001 at 19:50 UTC | |
by ichimunki (Priest) on Aug 21, 2001 at 01:26 UTC |