Hello all,

Thank you for your help regarding that script for downloading then deleting
the downloaded file.

I've made the script and after downloading the file, it deletes it from the
server.
This works fine.

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.

Do you have any idea what could I do to delete the file if the download is
cancelled?

And now another little problem with the script.
The problem is somewhere between Internet Explorer and the script, and I
think that modifying the script I can solve it.

I run the script with the ?fileName query string to download the "fileName"
file.
The download finishes fine, and the script deletes the "fileName" file from
the server.

Then in the same Internet Explorer window, I run again the script with the
"anotherFileName" query string, for downloading another file.

internet Explorer prompts me to download the second file, I choose "save"
but it doesn't appear that window for choosing a file name.
Instead, it appears an error message telling me that the server localhost
cannot be contacted to download the file script_name.pl.

If I close Internet Explorer, and open another window, it works fine without
any problem.

I've tried all the things from this message using Apache 2.0.36 in Windows,
and Apache 1.3 in Linux, with the same results.

Please advise me how can I solve these 2 problems, especially the first one.

Thank you very much.

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;


Teddy Center: http://teddy.fcc.ro/
Mail: [EMAIL PROTECTED]



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

Reply via email to