Upload File Using PHP - Example For Image
Create The HTML Form Create an HTML form, so you can choose file want to upload: *********************** Code *********************** <form action="upload.php" method="post" enctype="multipart/form-data"> Please choose a file: <input type="file" name=" uploadFile " accept="image/*" /> <br> <input type="submit" value="Upload File" /> </form> *********************** End of Code *********************** On the Above code accept is use for accepting only Image file as a File Input. If no accept is specify, All File are accepted. Create a upload.php file , whose code will be as Follow: *********************** Code *********************** ?php $target_dir = "uploads/"; $target_dir = $target_dir . basename( $_FILES["uploadFile"]["name"]); $uploadOk=1; // Check if file already exists if (file_exists($...

Comments
Post a Comment