web 2.0

How to use PHP & File Field / Upload File

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

PHP File Field / Upload File

PHP File Field / Upload File

PHP File Field / Upload File
.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.