Morpheusweb.it - Risorse per webmaster: script, ASP.NET, C#, Visual Basic .Net, tutorial, asp, javascript, css, php, html, java, ADO, VBScript, forms, frames, Active Server Pages, Dynamic HTML, database, gratis per webmaster e webdesigner

File Upload

Simple script for the upload of the files, with possibility to specify the maximum size of the file, and to attach comments.



<?
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">
&nbsp;&nbsp;<INPUT TYPE=RESET VALUE="Clear Form">
</TABLE>
</FORM>
</BODY>
</HTML>


Download code...


Print this page


 

Inizio pagina

risorse per webmaster