Managing errors when uploading files

I’ve just spent some time getting to the bottom of a problem with a page including two modals which insert and update records. The forms include options to upload an image and a PDF.

I did a number of tests and everything seemed to be working fine. Then I started to get error messages about a required field having no value. This was very puzzling because the field did contain data and it had been working before. I checked everything and couldn’t find a problem. The issue was giving a 400 error and indicated ‘field is required’. I removed the validation on the field concerned. Now there were no errors - but no data was inserted.

Eventually I tracked the problem down to one of the PDFs I was using for testing. It was too large for the PHP settings - an easy problem to fix when I found this was the problem. If it were not for the error message about the required field, I probably would have found the issue a lot sooner.

I’m still puzzled about the required field message. I imagine it could be that after the upload failed and the data couldn’t be inserted, this triggered the validation error.

When uploading files as part of insert or updates, I had assumed that testing for a successful operation in App Connect would be sufficient, but this doesn’t seem to be the case. I realise there are some validation options I could have added for the file uploads but is there a way I could have trapped for an error with a single step - eg can the Response step be used for this?

1 Like