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 22 views 22 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 Believe Hyp about Quantum Protection: Report March 11, 2025 Google Jemi is coming to Android Auto but the rollout is hassle March 10, 2025 How the drones are transmitting security on the US southern border March 7, 2025 Remember a uninterrupted tech trailballs: Tom Mitchell March 7, 2025 New HMD X 1 ‘Safe’ Phone: Protection for Parents, Great Factors for Kids March 5, 2025 Opera adds Agent AI to his browser March 4, 2025 Leave a Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment.