Check out your form tag in the html page.

does all the params set properly it should be something like this.

<form name="myform" action="getfile.pl" onsubmit="return check_form();"
enctype="multipart/form-data" method="POST">

The last param "enctype" is a must for file input type. which is genrally
not their for normal forms

let me know if you get it.

regards

Rajeev







----- Original Message -----
From: "Konstantin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, September 09, 2001 7:35 PM
Subject: upload file


Hi.

I'm trying to upload file with the next code:

#!/usr/bin/perl
use DBI;
use CGI qw/:standard/;
no strict;
use constant MAX_FILE_SIZE => 1_048_576;
use constant BUFFER_SIZE => 16_384;
my $buffer = "";

my $cgi=new CGI;

my $filename=$cgi->param('picture') || die ("No file name received.");
my $file=$cgi->upload('picture') || die ("No file received.");
$filename =~ s/^.*[\\|\/]//g;
$filename=~s/://g;

open(OUTPUT,">d:/pics/".$filename) || die ("Can not open output file");

binmode OUTPUT;
binmode INPUT;
my ($buffer,$bytesread);

while($bytesread=read($file,$buffer,1024) ){
    print OUTFILE $buffer;
 }

close INPUT;
close OUTFILE;

I get error message "No file received." so the execution of line
my $file=$cgi->upload('picture')
fails. Can anybody please help?

Thanks  in advance.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to