/// <inheritdoc /> /// <summary> /// Overridden. <inherited /> /// </summary> public override Stream GetWriteStream(UploadedFile file) { S3BlobInfo blobInfo = CreateBlobInfo(file); file.ServerLocation = blobInfo.Name; // TODO: pass length? return(_client.GetPutBlobStream(blobInfo)); }
/// <summary> /// Returns the <see cref="S3BlobInfo" /> that defines how to store given <see cref="UploadedFile" />. /// </summary> /// <param name="file">The <see cref="UploadedFile" /> for which to get a <see cref="S3BlobInfo" />.</param> /// <returns>The <see cref="S3BlobInfo" />.</returns> public virtual S3BlobInfo CreateBlobInfo(UploadedFile file) { string fileContentDisposition = null; if (!string.IsNullOrEmpty(_contentDisposition)) { fileContentDisposition = string.Format(_contentDisposition, file.ClientName); } S3BlobInfo blobInfo = new S3BlobInfo() { Name = GetObjectName(file), ContentType = !string.IsNullOrEmpty(file.ContentType) ? file.ContentType : "binary/octet-stream", CacheControl = _cacheControl, ContentDisposition = fileContentDisposition, ContentEncoding = _contentEncoding, CannedAcl = _cannedAcl, StorageClass = _storageClass // TODO: pass length? //Length = file.ContentLength > 0 ? (long?)file.ContentLength : null }; return(blobInfo); }
/// <summary> /// Returns the <see cref="S3BlobInfo" /> that defines how to store given <see cref="UploadedFile" />. /// </summary> /// <param name="file">The <see cref="UploadedFile" /> for which to get a <see cref="S3BlobInfo" />.</param> /// <returns>The <see cref="S3BlobInfo" />.</returns> public virtual S3BlobInfo CreateBlobInfo(UploadedFile file) { string fileContentDisposition = null; if (!string.IsNullOrEmpty(_contentDisposition)) fileContentDisposition = string.Format(_contentDisposition, file.ClientName); S3BlobInfo blobInfo = new S3BlobInfo() { Name = GetObjectName(file), ContentType = !string.IsNullOrEmpty(file.ContentType) ? file.ContentType : "binary/octet-stream", CacheControl = _cacheControl, ContentDisposition = fileContentDisposition, ContentEncoding = _contentEncoding, CannedAcl = _cannedAcl, StorageClass = _storageClass // TODO: pass length? //Length = file.ContentLength > 0 ? (long?)file.ContentLength : null }; return blobInfo; }