Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

write into a file using iis server

Status
Not open for further replies.

maxou23

Programmer
Jul 19, 2006
1
CA
Hi

I begin in perl and i wrote i little programm to upload a file and I want to wrote this file in in a new file but the file stay empty.


this is my code

use CGI;

my $q=new CGI();

print $q->header();
print $q->start_html("UPLOAD FILE");
print $q->start_form();
print $q->filefield('upload_file','starting value',50,80);
print $q->submit();
print $q->end_form();


if ($q->param('upload_file'))
{
my $fh=$q->upload('upload_file');

open (OUTFILE,">>allo.txt");
my $bytesread="";
my $buffer = "";
while ($bytesread=read($fh,$buffer,1024))
{
print OUTFILE $buffer;
}
close(OUTFILE);

}
print $q->end_html();
 
Make sure the form enctype is "multipart/form-data" for a form that is uploading a file.

Like this I think..
Code:
print $q->start_form( enctype=>"multipart/form-data" );

Jeb
 
Check the FAQ's here and in the Perl forum, there's some good working examples there too

HTH
--Paul

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top