public Guid WriteAttachment(FileContainer file) { var guid = Guid.NewGuid(); var tempName = string.Format( "{0}{1}.{2}", Path.GetFileNameWithoutExtension(file.Name), Path.GetFileNameWithoutExtension(Path.GetTempFileName()), Path.GetExtension(file.Name)); _uow.DbFiles.Add(new DbFile { FileName = tempName, OriginalFileName = file.Name, FileType = FileType.AffordablePrinting, Key = guid }); _uow.SaveChanges(); file.Name = tempName; _file.StoreFile(file); return guid; }
public void StoreFile(FileContainer file) { System.IO.File.WriteAllBytes(Path.Combine(TempPath, file.Name), file.FileContent); }
public void StoreFile(FileContainer file) { var blob = Container.GetBlockBlobReference(FormatFileName(file.Name)); using (var memoryStream = new System.IO.MemoryStream(file.FileContent)) { blob.UploadFromStream(memoryStream); } }