Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploading a file in electron programatically #1654

Open
Obadah-H opened this issue Jan 6, 2023 · 0 comments
Open

Uploading a file in electron programatically #1654

Obadah-H opened this issue Jan 6, 2023 · 0 comments

Comments

@Obadah-H
Copy link

Obadah-H commented Jan 6, 2023

I am trying to upload a file in electron (nodejs) using plupload by file path. I tried the following methods:

const form = new FormData()
form.append('file', fs.createReadStream(filePath));
uploader.addFile(form.file)
uploader.start();

Didn't work. I also tried:

var form = {
    name: 'file1',
    file: {
      value:  fs.createReadStream(filePath),
      options: {
        filename: 'Radio.xspf'
      }
    }
};
uploader.addFile(form.file)
uploader.start();

Also didn't work. I even tried to add a form in html, and then adding a file manually, and after that add the content of the html element using:

uploader.addFile(document.getElementById('files')) //Not working
uploader.addFile($('input[type="file"]')[0]) //Not working

In all cases, the file is not being added, as console.log(uploader.files) is empty. I need to implement adding files by path programmatically. Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant