How to use PHP & Upload File This the guideline/example a php scripts how to use PHP and Upload file to the Server.
ShotDev Focus:
- PHP & Upload file
Example
php_upload1.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form action="php_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_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_upload1.php
Screenshot