问题
I am trying to upload a verification document on stripe upload with below meteor method :
I am passing an object that contains the users identification document to to uploaded on the strip server for verification.
when I write the below method to upload the image file which is a png on the stripe server it gives me an error saying
"Error: ENOENT, no such file or directory 'C:\fakepath\success.png']"
Meteor.methods({
fileUploader("C:\\fakepath\\success.png"){ // path only for reference purpose
let fp = fs.readFileSync("C:\\fakepath\\success.
let StripefileUpload = new Future();
let file;
Stripe.fileUploads.create({
purpose: 'identity_document',
file: {
data: fp,
name: 'success.png',
type: 'application/octet-stream'
}
}, function(err, fileUpload) {
if (err) {
console.log(err);
StripefileUpload.return(err);
} else {
file = fileUpload.id;
console.log(file);
StripefileUpload.return(file);
}
});
return StripefileUpload.wait();
}
})
回答1:
Have you tried putting the file somewhere relative to the project? (ie. put it in the working directory?)
来源:https://stackoverflow.com/questions/38596157/stripe-fileuploader-in-meteor-js-gives-error-for-the-fakepath