#jr-file
1 messages ยท Page 1 of 1 (latest)
Yes
That is the code
๐ let me take a look
These are two images that we send from the front-end made in Flutter
When you log front and back what do you get?
What do yo mean ??
Like I want you to confirm that front and back are actually what you expect them to be and have all the file data
Let me share with you the front-end code
And this is the data of the two files we received from the front-end
Im still looking, but what debugging have you done on your end so far?
When you log front.data.length what do you get?
and what express middleware are you using for handling file uploads?
I get the size of the file
At the moment I am not using any middleware because I am sending valid files.
I was hoping that front.data.length was giving 0 since that would've explained why you're seeing this, but now I"m not super sure
and you're sure that what you're uploading is an jpg image and not something else, right?
Yes, Iโm sure
@haughty veldt In fact, you can see here in this picture that the file that the back is receiving is a jpg
Hello! I'm taking over and catching up...
Just because the filename has a .jpg extension doesn't mean the data in the file is actual JPEG data. Do you have this running on a Linux server?
If so, can you take the data you're getting on the server, dump it into a file, and then run file <filename> on it to determine the type of data in the file?
If you're using Windows you can use one of these approaches to determine what the data is: https://superuser.com/questions/274734/how-can-i-determine-file-type-without-an-extension-on-windows
Hi, it's running in local my backend I have it done in NodeJS and expresss.
Can you try to determine what the data in the file is using one of the approaches above?
This is the data I receive in my back end, sending from my front end app which is made in Flutter
Yep, I understand that. What I'm saying is can you dump that data into a file and then determine what type of data is in there using one of the approaches I described above?
Ok, let me try
I used a different tool than TrID because it would not open on my PC.
๐ Taking over this thread, catching up now
Hi
This is indeed strange. Can you try uploading another image?
Just want to check whether it is a file issue
Yes, I have tried several images, and I always get the same error.
Can you try reading the file directly from the backend instead of passing from frontend like this doc?
https://stripe.com/docs/file-upload#uploading-a-file
So that we can double check if it's due to corrupted data or something
That's a good news
Then we can narrow down that the file data passing from frontend to backend is likely to be corrupted
Ok, and now what ?? ๐
So the next step is find out how to read the data correctly from the frontend
I'm not too familiar with Flutter. Can you find out the difference between the data from frontend and the one reading directly from backend?
Then you can find similar function call in Flutter and pass the information to your backend
I don't understand what you mean by the difference in data between the front and the back.
When you print fp object, what does it show?
This
But when I get the data from the front end the buffer looks like this
Thanks for sharing. It looks like the buffer from frontend is empty
I'm not familiar with Flutter, so can't advice how to read the image buffer correctly in Flutter
I'd recommend searching online and ensure that the data pass from the frontend and the one reading directly in backend are the same
Ok, I will try to do what you tell me, if it doesn't work, I will post the issue again here in discord.