Octavian Rasnita wrote at Thu, 25 Jul 2002 11:21:42 +0200:

> The problem is that the file is not deleted if the visitor cancels the file download.
> 
> If the download is interrupted, the script is also interrupted I think, and it can't 
>delete the
> file.
> ...
> Here is the script:
> 
> #!/perl/bin/perl
> #!/usr/bin/perl
> 
> $| = 1;
> 
> my $filename = $ENV{'QUERY_STRING'};
> my $docroot = $ENV{'DOCUMENT_ROOT'};
> my $file = "$docroot/shopping/$filename";
> 
> print <<eof;
> Content-type: application/zip
> Content-Disposition: attachment; filename=$filename
> 
> eof
> 
> open (FH, $file);
> binmode(FH);
> binmode(STDOUT);
> 
> until (eof FH) {
> read (FH, my $buf, 1024);
> print $buf;
> }
> close FH;
> 
> unlink $file;

You could try to force the unlink,
even if the script is pleased to cancel.

END {
  unlink $file;
}

Well, versus a kill -9 yourscript.pl it, doesn't help.


Good luck,
Janek


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

Reply via email to