#jr
1 messages Β· Page 1 of 1 (latest)
Hi, taking a look here
Where ??
It looks like you're using the create a File API: https://stripe.com/docs/api/files/create, can you share the request id where it's throwing the not able to recognize the file error?
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
That is the code
What is the request id?
I donβt know what do you mean
https://support.stripe.com/questions/finding-the-id-for-an-api-request - this talks about how you can the request id.
This is the answer I get
Can you share this req_ with. me from the screenshot please?
This ??
yes, can you copy and paste the req_ here?
req_KdLfXX75VRQ6PP
From looking at this request, it appears that you're trying to send a file with a filename that ended in .jpg or .jpeg but when we looked at the data inside the file it didn't appear to be JPEG image data. Where is the data in the buffer from on your code?
This is the data from the image
Where is data: <Buffer> coming from?
I'm testing the route from postman, so what I do is to load the image in the form-data of postman
The problem is that I have already tried several images and they all give me the same problem.
I think that is where the issue is, when you load the image to postman, it might be be affecting the file type.
Can you try it without using Postman to rule this out?
How can I do it without trying postman ?
You can create it here: https://stripe.com/docs/api/files/create
OMG!! It worked! ππ
My code look like this now
And this is the response
But, I have a question
The idea is that the user from an application made in Flutter can send the image to verify his account, if I send it from the client I will not have the same problem?
It should not, as long as the file typeis not being altered in any way, that should work.
So once I have connected the client to the back, should I remove the fs.readFileSync() and pass the req.files.front.data ?
Yes, you'd want to test this and make sure that the file type is what you expect.
Okok, thank you ππ»