CGI Upload

Hi

I'm using the following code for PDF file upload via perl

The code is working.

but the file size is zero bytes

any suggestions

#!/usr/local/bin/perl -w


####### Load Needed Perl Modules ######
use strict;
# Make HTML/FORMS/UPLOADING easy to deal with
use CGI;
# Report errors in the browser
use CGI::Carp 'fatalsToBrowser';
# Limit file size
$CGI::POST_MAX=500000; # max 100K posts
####### End Perl Module Load #######


# Create new CGI object
my $q = new CGI;


if ( $q->param() ) {


# read filehandle from param and set to binary mode
my $filehandle = $q->param('proof_file');
binmode($filehandle);


# Strip off WINDOZE path ***
$_=$filehandle;
s/.*\\//;
my $filename=$_;


# open file for output - change this to suit your needs!!!
open(OUT,">upload/$filename") || die $!;
binmode(OUT);


# process $filehandle
{
my $buffer;
while ( read($filehandle,$buffer,500000) ) {
print OUT $buffer;
}
}


# close output file
close(OUT);


# show success
print $q->header,
$q->start_html,
$q->p('File uploaded: $filename'),
$q->end_html;
exit(0);


}

Thanks & Regards

kalyan kamesh

[1396 byte] By [kalikoi] at [2008-3-5]
# 1

Hi Kalyan,

The engineer looked at your code and provided the following.

This case is Perl related which is not a Microsoft technology or product. Although Perl can support either Windows platform or Linux platform, however from his code: #!/usr/local/bin/perl –w” it looks like a typical Linux path. So, it seems that you are working on the Perl code on Linux platform. You might want to post your request to a Perl newsgroup outside Microsoft.

Given that this is not a Microsoft product, our engineer is unable to assist, but I'm sure that you can find the answer to your question on another newsgroup that handles PERL.

Thanks,
-brenda (ISV Buddy Team)

MSISVBuddyTeam at 2007-9-8 > top of Msdn Tech,Microsoft ISV Community Center Forums,ISV Open Discussions...