Uploading file into the server is very easy task. In this tutorial you will learn how you can upload folder with files and files of sub folder using PHP. The steps and the source code of this tutorial is given in the following link.

How to upload folderĀ using HTML and PHP

How to upload folder using PHP code

Comments (6)

  1. I tried to write it as closely as possible to the video but it might not have worked
    If it doesn't work, im sorry i tried my best…

    <!doctype html>



    <meta charset="utf-8">

    <title>Untitled Document</title>



    <form action="#" method="post" enctype="multipart/form-data">

    Name Folder: <input type="text" name="foldername" /><br/></br/>

    Upload Folder: <input type="file" name="files[]" id="files" multiple directory="" webkitdirectory="" mozdirectory=""><br/><br/>

    <input class="button" type="submit" value="Upload" name='upload' />









    $foldername = $_POST['foldername'];



    foreach ($_FILES['files']['name'] as $i -> $name)


    if(strlen($_FILES['files']['name'][$i]) > 1)


    move_uploaded_file($_FILES['files']['tmp_name'][$i], $foldername.'/'.$name;



    echo"Upload Successful";



    echo "Upload Failed (You Didn't Add a Folder Name)";



Comments are closed.