Post form with image not working

When no image is selected in the form the data in the fields are being processed.

I don’t see what here goes wrong, I thought that maybe with the binary part the end wasn’t detected and causing the other fields not being parsed, that’s why I asked to put the file field to the end. Seems that that is not the case.

btw. which backend do you use, is it NodeJS?

Do you get any errors in the server logs, it seems to be something at the server side that has a problem with parsing the content it gets from cordova. Maybe it has to do with how data is encoded that is being send to the server.

@patrick I use NodeJs for the back-end. (all Wappler)

I am truely lost with this now…
The only way I can think of is to make a new api from scratch, but have little hope since I just follow the documentation to implement all my idea’s

Perhaps @Teodor or @George can try to reproduce it with a cordova iOS app uploading to a node server. I don’t have an apple device myself to test it with.

btw. Did the uploaded file get saved on the server?

If no image is selected, the data is saved in the database. If an image is selected, the error occurs.
I am able to share my project with you, @george or @teodor to see if this ‘bug’ can be found.

hi @Mennovandijk ,
For IOS, first convert image files to base64 and try to use it with API in this way. It will work this way. (You should use cordova plugin base64 option and use it like this.)

Actually there is no problem with the form as @patrick above said. The problem is with the plugin you are using. If you are developing applications for IOS and Android, you should get used to such problems :slight_smile:

1 Like

Hi @s.alpaslan,
thanks for your suggestion to look into base64.

@s.alpaslan
So… sometimes all what is needed is a little push into the right direction.
Based on a form post from Sid and this documentation : https://www.npmjs.com/package/base64-to-image
I managed to create a node module which converts a base64 upload to an image and stores is on my S3 cloud and the link in the database.
Not tried an iphone app yet, but I got good hopes!

@Mennovandijk
Congratulations in advance. I hope you will be successful in the IOS tests as well.

1 Like