HTML-form:
<FORM ENCTYPE="multipart/form-data" METHOD=POST ACTION="store.php">
<TABLE>
<INPUT NAME="max_file_size" TYPE="hidden" VALUE="3000000">
<TR>
<TD>Fil: </TD>
<TD><INPUT NAME="userfile" TYPE="file"></TD>
</TR>
<TR>
<TD></TD>
<TD><INPUT TYPE=submit VALUE=" skicka "></TD>
</TR>
</TABLE>
</FORM>
And php, on the recieving end: <?php
// check and validate uploaded file
if($_FILES['userfile'] == "none") {
die("Problem: Ingen fil uppladdad.");
}
if($_FILES['userfile']['size'] == 0) {
die("Problem: Filen �r tom.");
}
if($_FILES['userfile']['type'] != "text/plain") {
die("Problem: Filen �r inte en textfil.");
}
if(!is_uploaded_file($_FILES['userfile']['tmp_name'])) {
die("Problem: Filen �r inte uppladdad");
}$upfile = "__traningsmatcher.txt";
if(!copy($_FILES['userfile']['tmp_name'], $upfile)) {
die("Kunde inte spara filen");
}echo("Filen �r sparad!");
?>
-- anders thoresson
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

