Dear wise and powerful Monks of Perl,
I'm running a Perl script to download files from a website (and thank you again Joost for all your help), and it won't re-direct at the end of the script.
Given the script below (and the fact that I'm not a Perl but a Basis BBx/BBj programmer)...am I using the correct method of re-direct at the end of the script?
#!/www/perl/bin/perl.exe
#
# filednload.pl
#
# File Download Utility
#
use CGI;
use strict "vars";
my $cgiobject = new CGI;
my $filename = $cgiobject->param('filename');
my $filedir = $cgiobject->param('filedir');
my $movecode = $cgiobject->param('movecode');
my $usrcod = $cgiobject->param('usrcod');
my $userselect = $cgiobject->param('userselect');
my $filekey = $cgiobject->param('filekey');
my $server=$ENV{'SERVER_NAME'};
my $browser=$ENV{'HTTP_USER_AGENT'};
my $fileroot=$ENV{'DOCUMENT_ROOT'};
my $program = "DBXDND";
my $origpath = $fileroot . "/" . $filedir . "/" . $filename;
my $flsiz = -s $origpath;
print "Content-Type: application/octet-stream\n";
print "Content-Disposition: attachment; filename=$filename\n";
print "Content-Length: $flsiz\n\n";
open (DLFILE,"<$origpath") or die("cannot open file ");
binmode DLFILE;
binmode STDOUT;
my $buffer = '';
while(read(DLFILE,$buffer,1024)) { print $buffer; }
close DLFILE;
my $fileout=$fileroot . "/Temp/" . $usrcod . ".txt";
open (USER,">$fileout");
print USER "USRCOD=" . $usrcod . "\n";
print USER "BROWSER=" . $browser . "\n";
print USER "PROGRAM=" . $program . "\n";
print USER "FILENAME=" . $filename . "\n";
print USER "SERVER=" . $server . "\n";
print USER "DNLDDIR=" . $filedir . "\n";
print USER "DNLDFILE=" . $filename . "\n";
print USER "DNLDPATH=" . $origpath . "\n";
print USER "MOVECODE=" . $movecode . "\n";
print USER "USERSELECT=". $userselect . "\n";
print USER "FILEKEY=". $filekey . "\n";
close USER;
print $cgiobject->redirect("http://" . $server . "/cgi/cgi.exe?usrcod=
+" . $usrcod);
Thanking you in advance for the help,
Anton...
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|