Hi Tim - How's it going?

My name is Kimar and I'm looking to find out how to go about the
development of a video application using the database MySQL as I own my own
Domain name and am renting web host. This app may extend to greater than
just a video but more of a multimedia app.

I'm a developer based in Florida; I was trained at Atlantic Technical
College Coconut Creek. My instructor Ellen Williams; the hardest nut to
crack but a very generous woman. Lots of years experience and lots of
students. I graduated July 2017 and I've been doing some serious work on my
own until I was approached by some friends of mine that have angel
investors interested in a security login I've created.

I was recently attacked by someone from In2Cable India. I traced the IP
that was logged in the cPanel. The deal is my app is more secure than my
cPanel that requires me to have a hardware firewall that much I discovered
after the breach that there's little I can do about it unless there's a
hardware firewall or an app that is integrated in my browser to encrypt my
submission to the login until it hits the server. None the less I have
ongoing copyrighting processes occurring. You may or may not know about it
but copyright protects you more than patents. Explaining what your thing
does in the copyright proves you are the creator based on copyright clause
"Works of the Mind".

I am particularly interested in having the system input the actual audio
and video files such as MP3, or MPEG files to the database. I don't care
about memory or resources.

CREATE TABLE `video` (
 `ID` int(11) NOT NULL
 PRIMARY KEY ,
  `NAME` varchar(40) DEFAULT NULL,
  `DESCRIPTION` varchar(100) DEFAULT NULL,
 `BLOBFILE` varchar(20) );

That's the table I used and the web page below

<head>
<title> Test submit </title>
</head>
<body>
<h1> Test Perl Programming CGI post</h1>
<form action="/cgi-bin/post.pl" method="POST">
<label for="fileupload"> Select a file to upload</label>
Name: <input type="TEXT" name="Name">
Description: <input type="TEXT" name="Description">
<input type="FILE" name="fileupload"  name="Video">
<input type="SUBMIT" value="SUBMIT">
</form>
</body>
</html>

My question is how can I get the insert to work.

I tried reading the books on this topic and did a global search, I long
after exhausted all the links available.

I also am interested in using modules, is there a better explanation on
using the maker object on CPAN its a hard read as I still am lost to some
of the concepts in the manual.

I heavily rely on the perl.org resources so I decided to ask a professional.
none of the tests were able to add a value pair set to the database. They did 
execute but no real data was submited. The perl results were shown as the name 
of the file selected but no real insert. Looking in the database with 
PHPmyAdmin I feel embarrassed. I didn't see any real results.

worked

#!/usr/bin/perlml -wT
use cPanelUserConfig;
use CGI;
use warnings;
use strict;
use DBI;
use utf8;
my $q= new CGI;
print $q->header("text/plain");

my $dsn= "dbi:mysql:database=video;mysql_enable_utf8mb4=1";
# ;mysql_enable_utf8mb4=1 tells the perl server that the mysql utf must be 
enabled for use
my $user= "test";
my $pass= 'password';
my ($dbh, $sth, @row);

    $dbh= DBI->connect($dsn, $user, $pass, { PrintError => 0, RaiseError => 1, 
AutoCommit => 0 } ) or die "Cannot Connect: ".$DBI::errstr;
    
print "These are the results received\n";

my ($name, $value, @std, $num);

$num=0;
foreach $name ($q->param) {
    
        print "$name: ";

        foreach $value ($q->param($name) ) {
        $std[$num]= $value;
                print "$value\n";
        $num= $num+1;
        }

}

    print "DB Connect Attempted...<br>\n";
    
    #$q->$cgi->upload("file");
    
        $sth= $dbh->prepare("insert into video (name, description, blobfile) 
values ($std[0], $std[1], $std[2])") or die "Error due to - $dbh->errstr";
        #do statement can not be used with driver support placeholders hence 
the prepare statement must be used
    $sth->execute($q->param("upload_file")) or die "Error due to - 
$dbh->errstr";
    
    print "Statement Handle Executed...";
    
    $sth->finish();
    $dbh->disconnect();
    
exit;

worked

#!/usr/bin/perlml -wT
use cPanelUserConfig;
use CGI;
use warnings;
use strict;
use DBI;
use utf8;
my $q= new CGI;
print $q->header("text/plain");

my $dsn= "dbi:mysql:database=video;mysql_enable_utf8mb4=1";
# ;mysql_enable_utf8mb4=1 tells the perl server that the mysql utf must be 
enabled for use
my $user= "test";
my $pass= 'password';
my ($dbh, $sth, @row);

    $dbh= DBI->connect($dsn, $user, $pass, { PrintError => 0, RaiseError => 1, 
AutoCommit => 0 } ) or die "Cannot Connect: ".$DBI::errstr;
    
print "These are the results received\n";

my ($name, $value, @std, $num);

$num=0;
foreach $name ($q->param) {
    
        print "$name: ";

        foreach $value ($q->param($name) ) {
        $std[$num]= $value;
                print "$value\n";
        $num= $num+1;
        }

}

    print "DB Connect Attempted...<br>\n";
    
    #$q->$cgi->upload("file");
    
        $sth= $dbh->prepare("insert into video (name, description, blobfile) 
values ($std[0], $std[1], $std[2])") or die "Error due to - $dbh->errstr";
        #do statement can not be used with driver support placeholders hence 
the prepare statement must be used
    $sth->execute(my $cgi->param("upload_file")) or die "Error due to - 
$dbh->errstr";
    
    print "Statement Handle Executed...";
    
    $sth->finish();
    $dbh->disconnect();
    
exit;

worked

#!/usr/bin/perlml -wT
use cPanelUserConfig;
use CGI;
use warnings;
use strict;
use DBI;
use utf8;
my $q= new CGI;
print $q->header("text/plain");

my $dsn= "dbi:mysql:database=video;mysql_enable_utf8mb4=1";
# ;mysql_enable_utf8mb4=1 tells the perl server that the mysql utf must be 
enabled for use
my $user= "test";
my $pass= 'password';
my ($dbh, $sth, @row);

    $dbh= DBI->connect($dsn, $user, $pass, { PrintError => 0, RaiseError => 1, 
AutoCommit => 0 } ) or die "Cannot Connect: ".$DBI::errstr;
    
print "These are the results received\n";

my ($name, $value, @std, $num);

$num=0;
foreach $name ($q->param) {
    
        print "$name: ";

        foreach $value ($q->param($name) ) {
        $std[$num]= $value;
                print "$value\n";
        $num= $num+1;
        }

}

    print "DB Connect Attempted...<br>\n";
    my $cgi->param("upload_file");
    #$q->$cgi->upload("file");
    
        $sth= $dbh->prepare("insert into video (name, description, blobfile) 
values ($std[0], $std[1], $std[2])") or die "Error due to - $dbh->errstr";
        #do statement can not be used with driver support placeholders hence 
the prepare statement must be used
    $sth->execute() or die "Error due to - $dbh->errstr";
    
    print "Statement Handle Executed...";
    
    $sth->finish();
    $dbh->disconnect();
    
exit;

worked

#!/usr/bin/perlml -wT
use cPanelUserConfig;
use CGI;
use warnings;
use strict;
use DBI;
use utf8;
my $q= new CGI;
print $q->header("text/plain");

my $dsn= "dbi:mysql:database=video;mysql_enable_utf8mb4=1";
# ;mysql_enable_utf8mb4=1 tells the perl server that the mysql utf must be 
enabled for use
my $user= "test";
my $pass= 'password';
my ($dbh, $sth, @row);

    $dbh= DBI->connect($dsn, $user, $pass, { PrintError => 0, RaiseError => 1, 
AutoCommit => 0 } ) or die "Cannot Connect: ".$DBI::errstr;
    
print "These are the results received\n";

my ($name, $value, @std, $num);

$num=0;
foreach $name ($q->param) {
    
        print "$name: ";

        foreach $value ($q->param($name) ) {
        $std[$num]= $value;
                print "$value\n";
        $num= $num+1;
        }

}

    print "DB Connect Attempted...<br>\n";
    
    $q->upload("file");
        $sth= $dbh->prepare("insert into video (name, description, blobfile) 
values (?,?,?)") or die "Error due to - $dbh->errstr";
        #do statement can not be used with driver support placeholders hence 
the prepare statement must be used
    $sth->execute($std[0], $std[1], $std[2]) or die "Error due to - 
$dbh->errstr";
    
    $sth->finish();
    $dbh->disconnect();
    
exit;

worked

#!/usr/bin/perlml -wT
use cPanelUserConfig;
use CGI;
use warnings;
use strict;
use DBI;
use utf8;
my $q= new CGI;
print $q->header("text/plain");

my $dsn= "dbi:mysql:database=video;mysql_enable_utf8mb4=1";
# ;mysql_enable_utf8mb4=1 tells the perl server that the mysql utf must be 
enabled for use
my $user= "test";
my $pass= 'password';
my ($dbh, $sth, @row);

    $dbh= DBI->connect($dsn, $user, $pass, { PrintError => 0, RaiseError => 1, 
AutoCommit => 0 } ) or die "Cannot Connect: ".$DBI::errstr;
    
print "These are the results received\n";

my ($name, $value, @std, $num);

$num=0;
foreach $name ($q->param) {
    
        print "$name: ";

        foreach $value ($q->param($name) ) {
        $std[$num]= $value;
                print "$value\n";
        $num= $num+1;
        }
        print "$std[0], $std[1], $std[2]";
}
    $q->upload("file");

    
    print "DB Connect Attempted...<br>\n";

        $sth= $dbh->prepare("insert into video (name, description, blobfile) 
values ($std[0], $std[1], $std[2])") or die "Error due to - $dbh->errstr";
        #do statement can not be used with driver support placeholders hence 
the prepare statement must be used
    $sth->execute() or die "Error due to - $dbh->errstr";
    
    $sth->finish();
    $dbh->disconnect();
    
exit;

worked

Reply via email to