Hi,
I want my users to download a csv file. When they
left click on the link, it brings the file up within
the browswer. They can of course do a right click and
"Save Target As" depending on the browser.
But I don't want to fuss with instructions and
confused users. I would just like the same thing to
happen as a "Save Target As" on a left click.
So I made something up, but it isn't working. I get
an internal server error from the browser. When I run
it at a command prompt, it seems to work fine.
Here is the code:
print "content-type: multipart/mixed\n";
print "content-disposition: attachment;
filename=SampleListingUpload.csv\n";
open (FILE,
"<$ABS_PATH/httpdocs/SampleListingUpload.csv") or
die "Unable to load the sample listing
template. Reason: $!";
my $text = join "", <FILE>;
close FILE;
print $text;
And here is the output from a prompt:
-bash-2.05b$ ./sample_listing.cgi
content-type: multipart/mixed
content-disposition: attachment;
filename=SampleListingUpload.csv
Keywords,Bid Amount,Title,Url,Description
home mortgage,0.10,ABC Home
Mortage,http://www.ABCHomeMortgage.com,Instant Quotes
tax attorney,0.75,ACME Tax
Attorneys,http://www.acmetaxattorneys.com,Let us
represent you
-bash-2.05b$
Does anyone know what I'm doing wrong?
Thanks,
Denzil
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>