Php Code To Move Uploaded File To Another Directory
I Use In This Tutorial:
- NetBeans IDE .
- XAMPP .
Php Source Code:
<?php
if(isset($_POST['moveFile']))
{
$fileName = $_FILES['fileName']['name'];
$tempName = $_FILES['fileName']['tmp_name'];
if(isset($fileName))
{
if(!empty($fileName))
{
$location = "MyFilles/";
if(move_uploaded_file($tempName, $location.$fileName))
{
echo 'File Uploaded';
}
}
}
}
?>
<!DOCTYPE Html>
<html>
<head>
<title> PHP MOVE FILE </title>
</head>
<body>
<form action="php_move_upload_file.php" method="post" enctype="multipart/form-data">
<input type="file" name="fileName"><br><br>
<input type="submit" name="moveFile" value="Upload">
</form>
</body>
</html>
4 comments
commentsthank you. it works...
Replyyou are welcome
Reply100% Perfectly Worked !! :D
ReplyThank U Very Much !! :D
i have getting an error in line number 26
ReplyNotice: Undefined variable: search_result in C:\xampp\htdocs\d1\d6.php on line 27
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:\xampp\htdocs\d1\d6.php on line 27
please give a solution