Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Help with Upload Folders in JavaScript



  • Hello,

    this is my last Chance to get my JavaScript Sourcecode for Uploading Folders in qtwebengine.

    It works with the code:

    function uploadFiles(files) {
    
        // Create a new HTTP requests, Form data item (data we will send to the server) and an empty string for the file paths.
        var xhr = new XMLHttpRequest();
        var data = new FormData();
        var paths = "";
    
        // Loop through the file list
        for (var i in files) {
            // Append the current file path to the paths variable (delimited by tripple hash signs - ###)
            paths += files[i].webkitRelativePath + "###";
            // Append current file to our FormData with the index of i
            data.append(i, files[i]);
        };
        // Append the paths variable to our FormData to be sent to the server
        // Currently, As far as I know, HTTP requests do not natively carry the path data
        // So we must add it to the request manually.
        data.append('paths', paths);
    
        // Open and send HHTP requests to upload.php
        xhr.open('POST', "ajax/progress_ordner.php", true);
        xhr.send(data);
    
    }
    

    the Code works fine in all Browsers including Chrome/Chromium on Windows but in QTWebEngine (on Windows too) there are no "files[i].webkitRelativePath" entries...

    please help!

    Greets
    Robert


Log in to reply