I'm trying to submit a POST request with an image to an azure functions endpoint. The endpoint is going to upload the image to azure blob storage. Everything is hooked up, but I'm not sure how to process the form encoded image data to be uploaded to the blob storage account. I'd like to avoid adding express and am looking for alternatives to multer. I've tried consulting the documentation, but it also uses express/multer.
Below is what I have so far for the azure function. It's currently able to upload it to the azure storage account, but the data is not correct since I cannot display when I try to download it or view it.
export const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise<void> {
const storageConnectionString = config.storageConnectionString;
// Create the BlobServiceClient object which will be used to create a container client
const blobServiceClient = BlobServiceClient.fromConnectionString(storageConnectionString);
// Create a unique name for the container
const containerName = config.storageContainerName;
// Get a reference to a container
const containerClient = blobServiceClient.getContainerClient(containerName);
const blobName = context.bindingData.imageName;
// Get a block blob client
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
if (req.method === "POST")
{
const content = req.body;
const blobHeaders: BlobHTTPHeaders = {
blobContentType: "image/jpeg",
}
const options: BlockBlobUploadOptions = {blobHTTPHeaders: blobHeaders};
const uploadBlobResponse = await blockBlobClient.upload(content, content.length, options);
}
};
Here is my request from postman removing the token and the path to image.
curl --location --request POST 'http://localhost:7071/api/images/jaimeLannister.jpg' \
--header 'Cookie: BL_SiteLanguageID=1; __RequestVerificationToken=TOKEN' \
--form 'image=@/C:/jaimeLannister.jpg'
Any help would be appreciated!

