develooper Front page | perl.beginners.cgi | Postings from June 2011

file upload issues!

Thread Next
From:
Rahul!!
Date:
June 14, 2011 09:50
Subject:
file upload issues!
Message ID:
34c7558a-5cad-4375-bbc5-35fa613f75cf@p9g2000prh.googlegroups.com
Hi All,

Actually I am trying to store the file a user has uploaded through web-
page to database. But its not getting updated fully and it's showing
only few bytes. Point here is user will upload exe or dll and I have
to store it in DB. I am highlighting the code snippet,


//WEB PAGE CODE
<form method=post ENCTYPE="multipart/form-data">
<input type=hidden name=type value="application/octet-stream">
<b>Path to file:</b><br>
<input type=file name=data size=60><br><br>

<b>Description</b>:<br>
<input name=description size=60><br><br>
<input type=submit value="Submit">
</form>

# CGI code to insert data
 my $mimetype = $cgi->param('type');

$dbh->do"insert into req_attachments"
            . " (filename, description, mimetype, submitter_id,
thedata)"
            . " values"
            . "("
                . $dbh->quote($fname) . ", "
                . $dbh->quote ($description) . ", "
                . $dbh->quote($mimetype) . ", "
                . login_to_id($user->login) . ", "
            . $dbh->quote($cgi->param('data')) . ")");

Please let me know if I am doing something is wrong here
-Rahul


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About