We’re trying to upload a file and post some JSON data in a DTO to a ServiceStack endpoint from Angular JS. The endpoint does work and we can upload files to it using C#, but for some reason this does not seem to be as easy from Angular JS.
Are there any tricks we should know about? On the .NET side, the SS endpoint simply reads from the Request.Files collection. In JS, should we be:
- Using FileReader to readAsBinaryString and then send that to the endpoint.
- Using FileReader to readAsArrayBuffer then convert the byte array into a binary string and then send that to the endpoint.
- Using FileReader to readAsDataURL into Base64 and then convert the Base64 into a binary string and then send that to the endpoint.
- Doing something completely different?
Any help would be very much appreciated.