Hello
I am trying to accept a file upload, and respond in 2 parts.
First send a header and a message that file is writing.
Second add the message the file has finished writing.
#! usr/local/bin/perl -w
#$| = 1; # Tried and blah !
use CGI;
my $cgi = new CGI;
my $dir = "/temp";
my $file = $cgi->param('File_Upload');
print $cgi->header();
print "File has started writing to disk\n";
$file=~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the filename
my $name = $2;
open(LOCAL, ">$dir/$name") or die $!;
while(<$file>) {
print LOCAL $_;
}
close LOCAL;
print "$file has finished writing to disk ... thank you.\n";
But the first message and the second message arrive at the client before the file is written to disk.
How to have the 2nd print wait until the file is finished writing to disk ?
Thanks
Kode
I am trying to accept a file upload, and respond in 2 parts.
First send a header and a message that file is writing.
Second add the message the file has finished writing.
Code:
#! usr/local/bin/perl -w
#$| = 1; # Tried and blah !
use CGI;
my $cgi = new CGI;
my $dir = "/temp";
my $file = $cgi->param('File_Upload');
print $cgi->header();
print "File has started writing to disk\n";
$file=~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the filename
my $name = $2;
open(LOCAL, ">$dir/$name") or die $!;
while(<$file>) {
print LOCAL $_;
}
close LOCAL;
print "$file has finished writing to disk ... thank you.\n";
But the first message and the second message arrive at the client before the file is written to disk.
How to have the 2nd print wait until the file is finished writing to disk ?
Thanks
Kode