1234567891011121314151617181920212223242526 |
- using System.IO;
- using System.Net.Http;
- using System.Threading.Tasks;
- namespace VRPlatform
- {
- public class Uploader
- {
- private readonly HttpClient _client;
- public Uploader()
- {
- _client = new HttpClient();
- }
- public async Task UploadFileAsync(string url, string filePath)
- {
- using (var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
- {
- var content = new StreamContent(fileStream);
- var response = await _client.PostAsync(url, content);
- response.EnsureSuccessStatusCode();
- }
- }
- }
- }
|