simple-binary-upload
Service icon

simple_binary_upload

Stable version 1.0.4 (Compatible with OutSystems 11)
Uploaded
 on 10 May 2023
 by 
0.0
 (0 ratings)
simple-binary-upload

simple_binary_upload

Details
This is an extension for REST POST to simply upload a binary, if your environment doesn't support multiparts.
Read more

This extension is held as simple as possible. All input variables are self-explanatory besides the ContentName which is mainly the name of your binary. The used C# code looks as following. 

public static async void UploadImage2(string url, byte[] imageData, string url_params, string mediaType, string filename, string contentName)

        {

            try

            {

                using (var client = new System.Net.Http.HttpClient())

                {

                    using (var content = new System.Net.Http.MultipartFormDataContent())

                    {

                        var imageContent = new System.Net.Http.ByteArrayContent(imageData);

                        imageContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(mediaType);

                        content.Add(imageContent, contentName, filename);

                        var response = await client.PostAsync($"{url}?{url_params}", content);

                        response.EnsureSuccessStatusCode();

                        var responseContent = await response.Content.ReadAsStringAsync();

                        Console.WriteLine(responseContent);

                    }

                }

            }

            catch (Exception ex)

            {

                Console.WriteLine($"An error occurred: {ex.Message}");

            }

        }

Release notes (1.0.4)

add customized file upload

License (1.0.4)
Reviews (0)
Team
Other assets in this category