Created
June 27, 2019 09:53
-
-
Save felipebossolani/5f75a10933319ed925454ed24cf3400c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using AspNetCoreMultipleUploadAPI.ConsoleApp.Models; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Net.Http; | |
namespace AspNetCoreMultipleUploadAPI.ConsoleApp | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
try | |
{ | |
var fileInfos = new List<FileInfo>() { | |
new FileInfo(@"C:\temp\upload\google.png"), | |
new FileInfo(@"C:\temp\upload\facebook.png"), | |
new FileInfo(@"C:\temp\upload\twitter.png") | |
}; | |
var uploadRestClientModel = new UploadRestClientModel(); | |
var result = uploadRestClientModel.Upload(fileInfos).Result; | |
var fileResults = result.Content.ReadAsAsync<List<FileResult>>().Result; | |
Console.WriteLine("Status: " + result.StatusCode); | |
foreach (var fileResult in fileResults) | |
{ | |
Console.WriteLine("File name: " + fileResult.Name); | |
Console.WriteLine("File size: " + fileResult.Length); | |
Console.WriteLine("===================="); | |
} | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine(e.Message); | |
} | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment