Horje
c# webclient post file Code Example
c# webclient post file
private async Task<System.IO.Stream> Upload(string actionUrl, string paramString, Stream paramFileStream, byte [] paramFileBytes)
{
    HttpContent stringContent = new StringContent(paramString);
    HttpContent fileStreamContent = new StreamContent(paramFileStream);
    HttpContent bytesContent = new ByteArrayContent(paramFileBytes);
    using (var client = new HttpClient())
    using (var formData = new MultipartFormDataContent())
    {
        formData.Add(stringContent, "param1", "param1");
        formData.Add(fileStreamContent, "file1", "file1");
        formData.Add(bytesContent, "file2", "file2");
        var response = await client.PostAsync(actionUrl, formData);
        if (!response.IsSuccessStatusCode)
        {
            return null;
        }
        return await response.Content.ReadAsStreamAsync();
    }
}




Csharp

Related
convert object to iqueryable in c# Code Example convert object to iqueryable in c# Code Example
c# list subfolders Code Example c# list subfolders Code Example
mongodb driver c# nuget Code Example mongodb driver c# nuget Code Example
Long, Max and Min value Code Example Long, Max and Min value Code Example
vb.net remove last comma from string Code Example vb.net remove last comma from string Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11