コード例 #1
0
        public Yield PutFile(DreamContext context, DreamMessage request, Result <DreamMessage> response)
        {
            var      filepath   = GetPath(context);
            var      ttl        = context.GetParam("ttl", 0.0);
            TimeSpan?timeToLive = null;

            if (ttl > 0.0)
            {
                timeToLive = TimeSpan.FromSeconds(ttl);
            }
            try {
                _s3Client.PutFile(filepath, new AmazonS3FileHandle {
                    Stream     = request.ToStream(),
                    Size       = request.ContentLength,
                    MimeType   = request.ContentType,
                    TimeToLive = timeToLive
                });
                response.Return(DreamMessage.Ok());
            } catch (Exception e) {
                throw new DreamBadRequestException(e.Message);
            }
            yield break;
        }
コード例 #2
0
 public void PutFile(string path, AmazonS3FileHandle fileInfo)
 {
     Client.PutFile(path, fileInfo);
 }