I remember having done a solution like that to upload a file but I cannot seem to find it right now, unfortunately.
But as far as I remember I used this:
together with this setting (stream), with a put, not patch but this is just to get the screenshot:

If I get some time over in the coming week I will try to recreate it, but no promises.