meteor js中的条纹fileUploader给出了假路径的错误 [英] stripe fileUploader in meteor js gives error for the fakepath

查看:227
本文介绍了meteor js中的条纹fileUploader给出了假路径的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用下面的meteor方法上传条带上传验证文件:

我正在传递一个包含用户标识文件的对象来上传当我写下面的方法来上传图像文件,这是一个PNG的条纹服务器,它给了我一个错误说:$ / b>



错误:ENOENT,没有这样的文件或目录'C:\ fakepath\success.png']




  Meteor.methods({
fileUploader(C:\\ fakepath \\success.png ){//路径仅供参考
让fp = fs.readFileSync(C:\\ fakepath \\\\\\\\\\\\\)
let stripefileupload = new Future();
let file;
Stripe.fileUploads.create({
purpose:'identity_document',
file:{
data:fp,
name:'success.png' ,
类型:'applicati ($ er $),

},函数(err,fileUpload){
if(err){
console.log(err);
StripefileUpload.return(err);
} else {
file = fileUpload.id;
console.log(file);
StripefileUpload.return(file);

}
});
返回StripefileUpload.wait();



$ b $ div $解析方案

你有没有尝试把文件放在与项目相关的地方? (即把它放在工作目录中?)


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();
  }
})

解决方案

Have you tried putting the file somewhere relative to the project? (ie. put it in the working directory?)

这篇关于meteor js中的条纹fileUploader给出了假路径的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆