On Sun, 16 Aug 1998, Paul Miller wrote: # On Sat, 15 Aug 1998, John wrote: # # > If nobody else wants to do this, I will. Except users will have to upload # > the text (i have a lame java applet that lets you upload from your # > browser) then it would Have the switches and a Okay button. I see no need # > for password though. If you want it password protected just stick a # > .htaccess file in the base dir. # # Cool. So you can make the whole program in java, without running # additional programs? # # No one else has responded so far. I'd really appreciate it if you could # make the program.
How bout the attached one. You can also check it out at: http://neko.binary9.net/~nicholas/convert.cgi It seems the MSIE has a problem honoring the Content-type header. Under it, the SAVE AS dialog box wont appear in the unix -> dos direction :( # # Thank you, # Paul # G'day! ----------------------------------------------------------------------------- Nicholas J. Leon "Elegance Through Simplicity" [EMAIL PROTECTED] - - http://mrnick.binary9.net 8 4 9 1 7 3 <-- what is the pattern?
#!/usr/bin/perl use strict; use CGI; ############################################################################## my $self=new CGI; ### our state is based on whether we have access to some variables if (defined($self->param('xfile')) && defined($self->param('DIRECTION'))) { my $file=$self->param('xfile'); my $tounix=($self->param('DIRECTION') eq 'DOS to Unix'); my $short=$1 if $file=~/([_\-\d\.\w]+)$/; $short||="unknown.txt"; print "Content-type: application/octet-stream\n"; print "Content-Disposition: inline; filename=$short\n\n"; while ($_=<$file>) { chomp; print; if ($tounix) { print "\n"; } else { print "\r\n"; } } exit; } else { ### just display a form print $self->header; print $self->start_html(-title => 'DOS/Unix conversion', ); print $self->start_multipart_form(-method=> 'POST', -action=>$self->url ); print "File to convert: ".$self->filefield(-name => 'xfile', )."<br>\n"; print "Direction: ".$self->popup_menu(-name => 'DIRECTION', -values => [ 'DOS to Unix', 'Unix to DOS' ], )."<p>\n"; print $self->submit; print $self->endform; print $self->end_html; exit; }