Webuploader drag and drop upload files / folders, how to get the path of files

webuploader drag and drop to upload a file or folder, how to get the path webkitRelativePath of the file. If you use < input type= "file" / >, you can get the path of the file inside, but if you drag and drop, you will see that the path inside is empty.

// 
        uploader.on("fileQueued", function( file ) {
            console.log(file);
            uploader.md5File( file )

           // 
           .progress(function(percentage) {
               console.log("Percentage:", percentage);
           })
            // 
            .then(function(val) {
                // console.log("md5 result:", val);
            });
        });

        uploader.on("uploadBeforeSend",function(object,data,headers){
            console.log(object);

            data.webkitRelativePath=object.file.source.source.webkitRelativePath?object.file.source.source.webkitRelativePath:"";
            console.log(data);
            data.fileId="";
        });

when I upload with the input control, both the fileQueued event trigger and the uploadBeforeSend event trigger print can get the path of the file, but when I use drag-and-drop upload, the path is empty.
clipboard.png
clipboard.png


if it's just uploading, the File object of js can learn about it. It already contains the contents of the entire file and can be directly added to FormData upload. The path is basically useless, right? at least individuals haven't used it, unless in the electron environment, electron encapsulates the File object with the path attribute, which is the local absolute path of the file


drag-and-drop folder.


add a line of code in webuploader_folder.js to insert a file path of about 2173 lines, and then you can directly get var webkitRelativePath = file.source.source.fullPath;

webuploader_folder.js code in
uploader.on ('fileQueued', function (file) {
this method): add a comment line
_ traverseDirectoryTree: function (l, j) {
var I = e.Deferred (), k = this
if (l.isFile) {
l.file (function (m) {
m.fullPath = l.fullPathripple / (insert file path)
j.push (m);
i.resolve ()
})

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9e8e4-19e4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9e8e4-19e4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?