in reply to Force Download to a .xls file
If the program is running on Windows then make sure to binmode the file streams. This may be what is causing the file corruption.
#!/usr/bin/perl -w use strict; my $filename ="../somepath/test.xls"; print "Content-type: application/vnd.ms-excel\n"; print "Content-Disposition: attachment; filename=$filename\n"; print "\n"; open TMP, $filename or die "Error message here: $!\n"; binmode TMP; binmode STDOUT; print <TMP>;
--
John.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Force Download to a .xls file
by Andre_br (Pilgrim) on Jan 04, 2005 at 05:04 UTC | |
by holli (Abbot) on Jan 04, 2005 at 08:30 UTC | |
by holli (Abbot) on Jan 04, 2005 at 09:11 UTC |