CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
how do i upload files



Feb 7, 2001, 7:46 AM

Post #1 of 4 (147 views)
how do i upload files Can't Post

can someone please tell me how i can upload files from a users harddisk/floppy onto a webserver by using a perl cgi program.... all i wish to do is to alow users to upload pictures onto my website so they can be seen my others........

Administrator / Moderator

Feb 7, 2001, 10:51 AM

Post #2 of 4 (144 views)
Re: how do i upload files [In reply to] Can't Post

There's quite a few programs already available that perform file uploading. Check out

If you want to write your own, the best way to do it is via the modules.

Hope this helps!


Feb 7, 2001, 11:17 AM

Post #3 of 4 (141 views)
Re: how do i upload files [In reply to] Can't Post module? what is it and what do i do with it? sorry, i'm depressingly new to this........

Administrator / Moderator

Feb 7, 2001, 2:07 PM

Post #4 of 4 (136 views)
Re: how do i upload files [In reply to] Can't Post is a Perl module that makes cgi work a snap. It includes most of the common functions, as well keeps creating actual html code in your Perl program very easy.

Describing completely (which actually has an entire published book on it) is an impossible feat.

Here's some sample code from the book for file uploading using (as published on


use CGI qw/:standard/;

print header,
start_html('file upload'),
h1('file upload');
print_form() unless param;
print_results() if param;
print end_html;

sub print_form {
print start_multipart_form(),
submit(-label=>'Upload File'),

sub print_results {
my $length;
my $file = param('upload');
if (!$file) {
print "No file uploaded.";
print h2('File name'),$file;
print h2('File MIME type'),
while (<$file>) {
$length += length($_);
print h2('File length'),$length;


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives