California Consumer Privacy Act (CCPA) Opt-Out Icon by info.odysseyx@gmail.com October 21, 2024 written by info.odysseyx@gmail.com October 21, 2024 0 comment 17 views 17 background For sending multi-part/form data content in Logic App, there is official documentation that introduces how to achieve this. Create a workflow that calls an external endpoint or other workflow – Azure Logic Apps | Microsoft rear…. But recently, if we Content processing If the file name section contains non-ASCII characters (Chinese, Japanese characters), the file name is displayed as ????. If you implement Http operations according to the documentation. machine through testing curl There is an alternative way to send multipart/form-data by encoding all payloads as base64 encoded strings using the command: Here’s a sample payload sent from CURL: { "$content-type": "multipart/form-data; boundary=------------------------boundary", "$content": "base64 encoded content" } The decoded base64 string is in the usual multipart/form-data format. --------------------------boundary Content-Disposition: form-data; name="filename"; filename="[File name]" Content-Type: application/octet-stream File content binary --------------------------boundary-- avatar Depending on the mechanism, you will see that it is also possible to send multi-part forms using Logic App Http actions using the same format.o The only obstacle is how to combine the border header, file binary and border footer into a single base64 string. In most situations we get the file contents as separate base64 strings. As we all know, you can’t concatenate multiple base64 strings directly, so decoding may be wrong. So, we first need to convert all three parts to binary and combine them into a single byte.[]Then convert it all together to a base64 string. There is no built-in expression/function to handle this. As a workaround, you can prepare three base64 encoded strings (boundary header, file content and border footer) and then use the new feature “C# inline” to achieve this approach. Here is sample code: // Add the required libraries #r "Newtonsoft.Json" #r "Microsoft.Azure.Workflows.Scripting" using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Primitives; using Microsoft.Extensions.Logging; using Microsoft.Azure.Workflows.Scripting; using Newtonsoft.Json.Linq; public static async Task Run(WorkflowContext context, ILogger log) { var fileContent = (await context.GetActionResults("FileContent").ConfigureAwait(false)).Outputs; string header = (await context.GetActionResults("BoundaryHeader").ConfigureAwait(false)).Outputs; string footer = (await context.GetActionResults("BoundaryFooter").ConfigureAwait(false)).Outputs; byte[] headerBinary = Convert.FromBase64String(header.ToString()); byte[] footerBinary = Convert.FromBase64String(footer.ToString()); byte[] fileContentBinary = Convert.FromBase64String(fileContent.ToString()); List allBytes = new List(); allBytes.AddRange(headerBinary); allBytes.AddRange(fileContentBinary); allBytes.AddRange(footerBinary); string base64Content = Convert.ToBase64String(allBytes.ToArray()); return new Results { Message = base64Content }; } public class Results { public string Message {get; set;} } After you get the output from your C# action, you can configure it all into an Http action. Source link Share 0 FacebookTwitterPinterestEmail info.odysseyx@gmail.com previous post How Microsoft Learn Student Ambassador Program Transformed me next post Why and how Lenovo is dominating the field of AI You may also like Ride-sharing and Robotaxis Decopled Revenue Model Problems February 17, 2025 Web Raiders run the Global Brut Force attack from 2.5M IPS February 12, 2025 Generator Tech, Robot, risk of emerging February 11, 2025 Robotaxis is bringing in the lift dallas’ with ‘2026 with’ February 11, 2025 Why did Qualcom lose his first leadership February 10, 2025 Lenovo’s ThinkPad X 1 Carbon has rewrite my MacBook Pro February 5, 2025 Leave a Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment.