Post form with image not working

Not sure if it is a problem with the posted data or something else, could you create a dummy server action with just a setValue action in it and there use $_POST as expression for the value. Turn output on and then post your form to that endpoint for testing. It should then return the data you submitted in the json response and we know if the form data is correctly parsed on the server. You can also use something like https://requestinspector.com/ to inspect how data is being received.

I did as you described. Created a test api endpoint with the output values sent by the form:
When I update the name/text fields in the form only I get the response:
{
“voornaam”: “Kermitupdate”,
“achternaam”: “the Frog”,
“email”: “email@gmail.com”
}
as soon as I select an image to be sent with the form there is no value:
{}

It looks like something is preventing data to be send when an image is selected. But the api is triggered and sending a response. weird imho

And this only happens in a mobile app, so it works fine in the browser?

Yes, exactly. The same form/action in the browser (even on the phone) works

Hi @patrick,
After extensive testing and checking, I am still not able to solve this problem.
Again iOS only.
Everything works great on Android.
Final thing that comes to mind is a security setting in info.plist but am not 100% sure because there are some other similar issues regarding losing identity.
By now I am pretty confident to say that App Connect is somehow responsible for this problem.
Is it an idea to send the project file your way so we can get to the bottom of this?
I can set the api to debug modus so we can check.
Some other problems are also arising due to losing identity when doing a Post request to the api. Perhaps this is related.


Because you mention identity and iOS only I’m going to come in just in case it is relevant. Confirm your security provider is NOT set to same site equals Strict. Doing so will cause the security cookie to not be sent in certain circumstances. Use default instead.

Thanks Ken, really appreciate your reply. I know you are also working on a mobile app so your input is of great value :wink:
I just checked and the setting is set to ‘default’

@George Bump this thread…
Posting an image using a form on an ios cordova app, the api still throws an error about the required fields (while they are not empty)
This error only happens when an image is selected for upload.
Using the web browser on ios works fine using the same api.

I almost think this is a problem in cordova. It looks like somehow the form data is corrupted or not being correctly parsed.

Could you try the following:

  • Place the upload field at the end of the form, this is to test if it only affects fields after the file upload field.
  • Create a new action file with just a setValue action and use {{$_POST}} as value and turn output on. This way we can see when actually is being parsed.
  • Did you test the page in the safari webbrowser on iOS, so not creating a cordova app. This is to see if the problem is with safari or with cordova.

@patrick
it works in safari on the iphone so it must be something with cordova.
Perhaps an extra library needs to be added for sending data out of a cordova app?
I’ll also try your other bullets

It’s not a problem on Cordova Android applications, can confirm they work as expected.

Yes the same app on android work as expected.
@Dave, do you have the same issue?

We only provide for Android after having too many issues with the Apple App Store, so unfortunately I can not confirm your issue there. If the Android application you have is working definitely sounds like its specific to IOS. Sorry I can’t help further @Mennovandijk

@Dave Thanks for clarifying.
For me this is my last hurdle before I can release my app in the App Store.
Sounds simple right? just upload a form (which works on the website, android app, phone browsers… ) but not in a FW7 cordova app. While the data is being send to the api, the api returns errors… go figure :-S

I feel your pain @Mennovandijk, just sorry I can’t offer any advice on how to resolve the issue.

Thanks at least for thinking along. I cannot give up now, just one last thingy grrrr

1 Like

Did you try the other proposals, like moving the file field to the end of the form and testing with a separate server action?

working on it now @patrick

I get the same response.