Closed jasanishubh123 closed 8 months ago
Check this curl --location 'https://api.escuelajs.co/api/v1/files/upload' \ --form 'file=@"/Users/shubhamjasani/Desktop/ss.png"'
curl --location 'https://api.escuelajs.co/api/v1/files/upload' \ --form 'file=@"/Users/shubhamjasani/Desktop/ss.png"'
I got this output
import axios from 'axios'; import FormData from 'form-data'; import * as fs from 'fs'; const form = new FormData(); // twice quoted which throws error. form.append('file', fs.readFileSync('"/Users/shubhamjasani/Desktop/ss.png"'), '"/Users/shubhamjasani/Desktop/ss.png"'); const response = await axios.post( 'https://api.escuelajs.co/api/v1/files/upload', form, { headers: { ...form.getHeaders() } } );
Duplicate of #217
Check this
curl --location 'https://api.escuelajs.co/api/v1/files/upload' \ --form 'file=@"/Users/shubhamjasani/Desktop/ss.png"'
I got this output