Hi, I have a script that outputs a file as text to the browser but there are some inconsistencies in how the browser responds to script.
When the script is run under FF it displays the text and you can choose to 'Save the page' from the file menu and it is saved as text. Under IE the page is not displayed at all but a 'Save as' dialogue box appears, and the type is set to unknown. I could live with that. However the problem is compounded by the fact that if you choose to save the file, it will save the file as convert-csv.pl. If you choose open (and have perl installed) it will try to run convert-csv.pl but it dosen't exist. So there are 2 questions really. 1) Is there a way to force IE to display a file as plain text. I am tried 'text' and 'text/plain' but neither make a difference. If I have read the correct RFC (rfc2046) it says of the type text: "text -- textual information. The subtype "plain" in particular indicates plain text containing no formatting commands or directives of any sort. Plain text is intended to be displayed "as-is". 2) How can you use the Content-disposition header to make IE save the file with another name. # relevant lines print $q->header(-type=>'text/plain', -Content-Disposition=>{type=>'inline',filename=>"$filename"}, ); Any help would be appreciated. Thanx. Dp. ========== convert-csv.pl ========== #!/usr/bin/perl -w ############# # import a csv file into a tilde separated file or vice-versa ############### use CGI; use CGI::Carp qw(fatalsToBrowser); $CGI::POST_MAX = 1024 * 1000; # Set limit to 1MB use strict; use warnings; use Text::ParseWords; ..snip else { my $filename = $q->param('uploaded_file'); my $csv_type = $q->param('filetype'); print $q->header(-type=>'text/plain', -Content- Disposition=>{type=>'inline',filename=>"$filename"}, ); my $untainted_filename; my $type = $q->uploadInfo($filename)->{'Content-Type'}; unless ($type eq 'text/plain' or 'text/html') { print STDERR "Type = $type\n"; die "Text files only"; } if (! $filename && $q->cgi_error) { print $q->header(-status=>$q->cgi_error); exit 0; } (my $tmp_name = $filename) =~ s/\W+/_/g; if ($tmp_name =~ /^([-\@:\/\\\w.]+)$/) { $untainted_filename = $1; } else { ...snip -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>