public MediaItem CreateMediaItem(Stream fileStream, string fileName, string contentType, string container) { EnsureAmazonS3Connection(); _factory.CreateObject(container, fileStream, contentType, fileName); return(GetMediaItemById(fileName)); }
/// <summary> /// Saves the editor control value. /// </summary> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void DataEditorControl_OnSave(EventArgs e) { string fileUrl = string.Empty; string bucketName = string.Empty; var postedFile = this.m_Control.PostedFile; if (postedFile != null) { StorageFactory factory = new StorageFactory(m_Control.Options.AccessKey, m_Control.Options.SecretKey); fileUrl = factory.CreateObject(bucketName, postedFile.InputStream, postedFile.ContentType, postedFile.FileName); } // save the value of the control depending on whether a new file is uploaded this.Data.Value = string.IsNullOrEmpty(fileUrl) ? m_Control.FileUrl : fileUrl; }