The output I get is:#!/usr/bin/perl $DEBUG = 0; ######## use CGI; $query = new CGI; ######## $type = 'something/else'; print $query->header(); $ERROR = $query->cgi_error; $fh = $query->upload('$filename'); $filename = escapeHTML($query->param('attfile')); $type = $query->uploadInfo($filename)->{'Content-Type'}; unless ($type eq 'text/html') { die "HTML FILES ONLY!"; } if (!$fh) { print_html($ERROR); exit 0; } else { print_html("The file was of type ", $type); } if($DEBUG == 1) { @Everything = <$fh>; print_html(@Everything); } sub print_html { @String_To_Use = @_; $SizeOfArray = $#_; $Count = 0; print $query->start_html(); print "<CENTER>\n"; while($Count <= $SizeOfArray) { print "$String_To_Use[$Count]\n"; print "<BR>\n"; $Count++; } print "</CENTER>\n"; print $query->end_html(); }
The file that I'm inputting, ie the filefield is C:\filename.txt<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=windows-1252 +"></HEAD> <BODY></BODY></HTML>
Any help is greatly appreciated.
Thanx
Ryan Howerton
Edit 2001-03-13 by tye to remove <PRE>.
In reply to Reading a File Uploaded to a cgi script by rhowerton
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |