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