Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
93
rated 0 times [  95] [ 2]  / answers: 1 / hits: 8668  / 4 Years ago, mon, november 23, 2020, 12:00:00

I'm following a tutrotial and all off a sudden i'm getting this error . I've tried all solution and reinstall module. but in other class the same code work


this is my code


import fileSaver from 'file-saver';

uploadPensiun(event) {
const files = event.target.files
const formData = new FormData()
formData.append('Pensiun', files)
fetch('http://localhost:5000/uploadpensiun', {
method: 'POST',
body: 'Pensiun',
headers: {
'Accept': 'application/json',
'Content-Type': 'multipart/form-data'
},
})
.then(res => res.json())
.then(data => console.log(data))
.catch((err) => console.log(err));

}

anyone can help me please?


More From » node.js

 Answers
11

Install the file-saver


with npm:


npm install file-saver


or with yarn:


yarn add file-saver


[#2255] Wednesday, November 18, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kaia

Total Points: 574
Total Questions: 109
Total Answers: 110

Location: Malaysia
Member since Wed, May 11, 2022
2 Years ago
;