tom123
08-13-2007, 03:05 PM
Hi All
I'm trying to send an pdf file to a users computer i.e They click on a link and a "Save As" box allows them save the file to their computer.
I currently have the following code:
my $pdf_file_name = "/tmp/order1.pdf";
# Open file and put contents in temporary filehandle
open(READ_FILE,"<$pdf_file_name") || Error('open'.'file'); #or die "Could not open $pdf_file_name for reading: $!\n";
my @file_holder = <READ_FILE>;
close(READ_FILE) || Error('close','file'); #or die "Could not close $pdf_file_name: $!\n";
# Send file to screen for user to save to their desktop
print "Content-Type:application/x-download\n";
print "Content-Disposition:attachment;filename=$pdf_file_name\n\n";
print @file_holder;
Problem is the save as option dosent apperar.
Insted a load of garbage is written to the Response header (In firebug)
Any help greatly appreciated.
I'm trying to send an pdf file to a users computer i.e They click on a link and a "Save As" box allows them save the file to their computer.
I currently have the following code:
my $pdf_file_name = "/tmp/order1.pdf";
# Open file and put contents in temporary filehandle
open(READ_FILE,"<$pdf_file_name") || Error('open'.'file'); #or die "Could not open $pdf_file_name for reading: $!\n";
my @file_holder = <READ_FILE>;
close(READ_FILE) || Error('close','file'); #or die "Could not close $pdf_file_name: $!\n";
# Send file to screen for user to save to their desktop
print "Content-Type:application/x-download\n";
print "Content-Disposition:attachment;filename=$pdf_file_name\n\n";
print @file_holder;
Problem is the save as option dosent apperar.
Insted a load of garbage is written to the Response header (In firebug)
Any help greatly appreciated.