Auth0 Home Blog Docs

Uploading files via angular-jwt (Angular 2)


#1

I’m trying to find a way to upload files to a C# Web API from a website that uses Angular 2 but I am having no luck with it. The AuthHttp module has no way to send files to the API. I don’t know what to parameterize the file data on the API so that the data type matches, if it’s even possible to send files in JSON format.

I also tried to send the data as multipart/form-data, but none of the values from the FormData are present, but when I try to send a POST request via the standard @angular/http module the file shows up, which should mean I am sending the files the correct way. Even after removing global headers, it doesn’t work.

I looked around but none of the solutions seemed to work. I just want to be able to upload files to the API while also using Auth0.