Created
June 27, 2019 10:17
-
-
Save felipebossolani/a5221a30878fdc2cb1c159f8feec1b9b 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; | |
using System.Threading; | |
namespace AspNetCoreMultipleUploadAPI.ConsoleApp | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Sleep for 5 seconds."); | |
Thread.Sleep(5000); | |
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); | |
} | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment