terça-feira, 18 de abril de 2023

How to parse Multipart Form File

 To parse multipart form using .NET 7, you can use the MultipartFormDataParser class from the Http-Multipart-Data-Parser package1. You can parse the stream containing the multipart/form-data by invoking MultipartFormDataParser.Parse (or it’s asynchronous counterpart MultipartFormDataParser.ParseAsync). Access the data through the parser1.

Here’s an example of how you can parse a multipart/form-data request in .NET 7 using Http-Multipart-Data-Parser package1:

using HttpMultipartParser;
using System.IO;

// ...

var parser = new MultipartFormDataParser(Request.Body);
foreach (var file in parser.Files)
{
    var filename = file.FileName;
    var contentType = file.ContentType;
    var content = file.Data;
    // Do something with the file
}

I hope this helps! Let me know if you have any other questions.

segunda-feira, 3 de abril de 2023

Azure Event Grid Storage Account PutBlob DeleteBlob Events


{"api":"PutBlob","clientRequestId":"11274a18-88ad-4038-8411-0f8c12e06016","requestId":"f336c9c2-301e-0054-113a-6636d4000000","eTag":"0x8DB345182F07EBA","contentType":"video/mp4","contentLength":18026572,"blobType":"BlockBlob","url":"https://[storageaccount].blob.core.windows.net/teste/dub_portugues.mp4","sequencer":"0000000000000000000000000000663400000000013c15cb","storageDiagnostics":{"batchId":"96d72e50-6006-0014-003a-6631ec000000"}}

{"api":"DeleteBlob","clientRequestId":"5f63b2d5-e9ed-4dca-9a02-484424c9b6d6","requestId":"12e55510-e01e-0057-4e3a-66d7b0000000","eTag":"0x8DB34516DF03AB1","contentType":"video/mp4","contentLength":18035781,"blobType":"BlockBlob","url":"https://[storageaccount].blob.core.windows.net/teste/dub_espanol.mp4","sequencer":"0000000000000000000000000000663400000000013c143d","storageDiagnostics":{"batchId":"96d682ca-6006-0014-003a-6631ec000000"}}


Related:

How to receive Azure Storage Account Network Share File and Directory events on Azure Event Grid Subscription?

https://stackoverflow.com/q/75921159/194717