How to use FormData in ES6 syntax?
See original GitHub issueI have tried to run following code
import FormData from 'form-data'
...
const formData = new FormData();
formData.append('chart', chartfile)
...
Unfortunately, I get a error like below
form_data_1.default is not a constructor
Let me know where the issue come from.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:14
- Comments:5
Top Results From Across the Web
FormData - The Modern JavaScript Tutorial
FormData objects are used to capture HTML form and submit it using fetch or another network method. We can either create new FormData(form)...
Read more >FormData() - Web APIs - MDN Web Docs - Mozilla
The FormData() constructor creates a new FormData object. Note: This feature is available in Web Workers. Syntax. new FormData() ...
Read more >JavaScript FormData
Create a FormData object · First, select the submit button using the querySelector() method of the document object. · Next, add an event...
Read more >What is a formData Object in JavaScript? - Educative.io
We created a FormData object using an empty FormData constructor. Then, we added some data in the form of name-value pairs using the...
Read more >How to use FormData in node.js without Browser?
6 Answers 6 · 2. Thanks for your answer. · If its node js, you only can do var FormData = require('form-data'); Node...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You would use as
import * as FormData from 'form-data'
to access all modules in a single variable.For me this is what worked:
import { default as FormData } from "form-data";