'Upload a empty folder with js or jquery

hello there I am building a folder upload system with js and PHP but I got an issue I'm not able to upload a folder that not contains any files

I use

    <input type="file" id="picker" name="files" webkitdirectory multiple>

and for getting the file i use

    $('input[type="file"]').on("change", function (e) {
        let files = $(this).get(0).files;
        console.log(files);
    });

if a folder contains any file so I can easily access the folder using

files[i].webkitRelativePath

what is the problem I'm just getting files that contain webkitRelativePath not getting the folders directly so I'm not able to get any empty subfolders with this approach

can anyone tell me how to access folders directly without webkitRelativePath or anything else so I can handle empty subfolders



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source