C
C#2y ago
malkav

Upload a Stream (file) to an Azure Function that uploads it to the Blob Storage

Say I wanted to upload a file from a Static Web App, so I get the file as a Stream and toss it towards an Azure function that handles the blob storage and returns a URL string. How would I get the file into the Azure function? I did req.Form.Files[0] now, and that worked in a test environment, but in tandem with the website I'm making I'm supposed to give a req.Body to this Azure function right? So how would I approach this? I've got the connection to the blob storage, and the actual upload and retrieve url sorted. It's just how to get the file from a web-page to an azure function
2 Replies
malkav
malkav2y ago
edit of original question: does anyone know what happens to my data when I make an HTTP call to Post url, and in the request I add StreamContent instead of stringcontent. How do I retrieve this from the request on the API side?? Premise: I've got an Azure Function to Upload a file to a blob storage. Apart from this I have a Blazor WASM project, that calls the Azure function when I want to upload a file. I can do that by HttpClient.Client.PostAsync("my.url.whatever", new StreamContent(file)), but now I'm trying to figure out where in my Azure Function's HttpRequest can I get this Streamcontent from? do I just HttpRequest.Body["file"]? or do I reach this some other way?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View