I’m using a webhook that accepts a post request from an html form.
The form has multiple fields, including multiple file input fields. I need to know which image was uploaded in which input field.
Before I didn’t have ‘Binary data’ enabled in the webhook node and the form had multipart/form-data off and I noticed that the filename would be passed along in the json.
With multipart/form-data on however and Binary data set to on in the node, I get all uploaded files, but the names of the input fields are gone from the json and not present in the binary info. Also the binary files themselves are not in the same order as they were in the original form. So manually matching positions is not an option.
How do I go about this? I know I could process the uploads separately and then just have URLs send instead of the actual files, but that is a workaround I’d rather not make.
Hey @MutedJam thanks for the response. you can find my webhook here:
For reference: We’ve got a giant feedback form with +30 input fields, 16 of them are images. Our teammembers take pictures with their phones and upload these to the corresponding file-input-fields.
There might be an image for Room A and one for Room B both are present int the form as <input type="file" name="room-a-picture" /> and <input type="file" name="room-b-picture" /> . When uploaded these are usually named IMG_xxx.
So when submitted by a user: for Room A the photo might be IMG_285 and for Room B it might be IMG_284. We don’t know in which order the photos were taken, we don’t know in which field they where uploaded and the order in which they are visible in n8n does not correspond to the position of that field within the form. So for us it’s impossible to know which picture is from Room A and which is from Room B; Room C which also exists as an input field might even be empty. That information is present in the original request but is stripped in the beforementioned sourcecode.
To sum it up: I don’t care about the filename of the file, I care about the inputfield name of the file.
That one is interesting, I have given it a quick test and it looks like you can send binary data with or without it so there must be something else it does. I will have to dig through the code to work it out unless @MutedJam knows.