PX : code

Uploading Files in PHP by SS
Rating: 4.00
Download this code


<html>

<form action="myupload.php" method=post enctype="multipart/form-data">
submit this file: <input type=file name="userfile" size="20"><br>
<input type=submit><br>
</form>
</html>
//////////////
<html>
<?

if(!empty($userfile)) {
 
//copy the file
copy($userfile, "/php/www/files/myfile.txt");

//destroy the uploaded file
unlink($userfile);

//display message
echo("file uploaded");

}
?>
</html>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.