<?
// fileupload.php3
//
// by Jeff Schmitt
// Towson University
// April, 1998
//
//================================================== ========
//Date: Mon, 11 May 1998 09:24:15 -0400
//From: Colin Viebrock <cmv@privateworld.com>
//
//PHP doesn't take the MAXLENGTH attribute from the file input field. You
//need another hidden field like this:
//
//<input type="hidden" name="MAX_FILE_SIZE" VALUE="1000000">
//================================================== ========
// look at the HTML form variables
if ($action) {
?>
<HTML><HEAD>
<TITLE>file upload report</TITLE>
</HEAD>
<BODY>
<H2>file upload report</H2>
<DL>
<DT>File:
<DD> <? echo $name;?>
<DT>Comment:
<DD> <? echo $comment;?>
</DL>
<?
echo "<PRE><TT>\n";
if ($fp=fopen($name, "r")) {
while ($line=fgets($fp,500)) {
// convert HTML special characters to HTML printable versions
$line=htmlspecialchars($line);
echo "$line";
}
fclose($fp);
}
echo "</TT></PRE>\n";
echo "<P> <A HREF=\"$PHP_SELF\">Upload another</A>\n";
exit;
}
?>
<HTML><HEAD>
<TITLE>file upload test</TITLE>
</HEAD>
<BODY>
<H2>file upload test</H2>
<HR NOSHADE>
<H3>Choose a file to upload: </H3>
Note: you can upload any type of file BUT since
this program will show you the file, please submit only
ascii text files.
<FORM METHOD="POST" ACTION=" <?echo $PHP_SELF;?>"
ENCTYPE="multipart/form-data">
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000">
<TABLE BORDER=1>
<TR><TH>File Name:
<TD><INPUT NAME="name" TYPE="FILE">
<TR><TH>Comment:
<TD><INPUT NAME="comment" size=30 MAXLENGTH=30>
<TR><TH>Action:
<TD><INPUT TYPE="SUBMIT" NAME="action" VALUE="Submit">
<INPUT TYPE=RESET VALUE="Clear Form">
</TABLE>
</FORM>
</BODY>
</HTML>