How to use PHP & File Field / Upload File This tutorial how to using PHP read a variable from File Field and Upload file.
ShotDev Focus:
- Using PHP & File Field (Upload file)
Example
php_file_upload1.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form action="php_file_upload2.php" method="post" name="form1" enctype="multipart/form-data"> <input type="file" name="fileUpload"> <input name="btnSubmit" type="submit" value="Submit"> </form> </body> </html>
php_file_upload2.php
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
if(copy($_FILES["fileUpload"]["tmp_name"],"shotdev/".$_FILES["fileUpload"]["name"]))
{
echo "Copy/Upload completed.";
}
?>
</body>
</html>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_file_upload1.php
Screenshot




