summaryrefslogtreecommitdiff
path: root/kurier/S3.cs
blob: 55993d1694ace511f1fb1e889becda24c3ed7bac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.Text;
using Amazon.S3;
using Amazon.S3.Model;
using System.IO;
using System.Windows.Forms;
using Amazon;

namespace kurier
{
    class S3
    {
        private AmazonS3Client _client;

        public S3()
        {
            this._client = new AmazonS3Client(Properties.S3Settings.Default.AWS_ACCESS_KEY, Properties.S3Settings.Default.AWS_SECRET_KEY, RegionEndpoint.EUCentral1);
        }

        public void send(string bucket, string filePath, string remotePath)
        {
            PutObjectRequest request = new PutObjectRequest { 
                BucketName = bucket,
                Key = remotePath,
                ContentBody = File.ReadAllText(filePath) };
            this._client.PutObject(request);
        }
    }
}