Hello all,
I have a page that lets people choose a PDF to download via radio buttons. Everything works fine on my end. However, client says that when they do the download they get an error and cannot open the file.
My guess is there is a problem on her box, but I cannot convince her that running win2k on a mac g4 using virtual PC is the problem.![[ponder] [ponder] [ponder]](/data/assets/smilies/ponder.gif)
So, just to make sure I have all of my ducks in a row before I tell her to get over it, would you all be so kind as to take a quick look at the script and see if I missed anything?
I know that this isn't the pretties code around, but any suggestions appreciated.....
Jim
I have a page that lets people choose a PDF to download via radio buttons. Everything works fine on my end. However, client says that when they do the download they get an error and cannot open the file.
My guess is there is a problem on her box, but I cannot convince her that running win2k on a mac g4 using virtual PC is the problem.
![[ponder] [ponder] [ponder]](/data/assets/smilies/ponder.gif)
So, just to make sure I have all of my ducks in a row before I tell her to get over it, would you all be so kind as to take a quick look at the script and see if I missed anything?
I know that this isn't the pretties code around, but any suggestions appreciated.....
Jim
Code:
my $query = new CGI;
my $file = $query->param("file");
my $filename;
my $filesize;
my $DLfile;
my $first_name = $query->param("first_name");
my $last_name = $query->param("last_name");
my $company = $query->param("company");
my $address = $query->param("address");
my $city = $query->param("city");
my $state = $query->param("state");
my $zip = $query->param("zip");
my $phone = $query->param("phone");
my $fax = $query->param("fax");
my $email = $query->param("email");
my $Track = $query->param("Track");
my $filePath = '/pdfs/';
if ($file eq "RegDShort") {
$filename = "Agreement.pdf";
}
if ($file eq "RegDLong") {
$filename = "RegDOffering.pdf";
}
my $filesize = -s $filename;
# print full header
print "Content-disposition: attachment; filename=$filename\n";
print "Content-Length: $filesize\n";
print "Content-Type: application/pdf\n\n";
# open in binmode
open my $read,'<',$filePath.$filename or die "Failed to read $filename - $!";
binmode $read;
# stream it out binmode
binmode STDOUT;
while (<$read>) {
print;
}