A simple file upload code in php


if (isset($_POST['submit'])){

$file_name = $_FILES['fileToUpload']['name'];
$file_type = $_FILES["fileToUpload"]["type"];
$tmp_path = $_FILES["fileToUpload"]["tmp_name"];
$path = 'uploads/'.$file_name;
    move_uploaded_file($tmp_path, $path);



<html lang="en">
<meta charset="UTF-8">
<title> File Upload </title>
<body align = "center">
<h1>File Upload</h1>
<form method="POST" action="" enctype="multipart/form-data">
<LABEL> Upload Your Image Here:</LABEL>
<input type="File" name="fileToUpload">
<input type="submit" name="submit" value="Upload">

Share it in your network:

Leave a Comment

Your email address will not be published. Required fields are marked *



You have successfully subscribed to my email list. Now you will be recieving latest wordpress tips and tricks directly in your mail box.

Don’t worry! I won’t spam you