diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs index 3ff1fb2f6..2bc2a9c27 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs +++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs @@ -43,6 +43,8 @@ namespace Orchard.Azure.Services.FileSystems.Media { // Create the file. The CreateFile() method will map the still relative path. var file = CreateFile(path); + inputStream.Position = 0; // We need to read from the beginning of the stream, even if it isn't at it's beginning. + using (var outputStream = file.OpenWrite()) { var buffer = new byte[8192]; while (true) { @@ -52,6 +54,8 @@ namespace Orchard.Azure.Services.FileSystems.Media { outputStream.Write(buffer, 0, length); } } + + inputStream.Position = 0; // Rolling back the stream so external readers will have it easier. } /// diff --git a/src/Orchard/FileSystems/Media/FileSystemStorageProvider.cs b/src/Orchard/FileSystems/Media/FileSystemStorageProvider.cs index 5b6200657..f5f7a55d7 100644 --- a/src/Orchard/FileSystems/Media/FileSystemStorageProvider.cs +++ b/src/Orchard/FileSystems/Media/FileSystemStorageProvider.cs @@ -336,6 +336,8 @@ namespace Orchard.FileSystems.Media { // The CreateFile method will map the still relative path var file = CreateFile(path); + inputStream.Position = 0; // We need to read from the beginning of the stream, even if it isn't at it's beginning. + var outputStream = file.OpenWrite(); var buffer = new byte[8192]; for (;;) { @@ -346,6 +348,8 @@ namespace Orchard.FileSystems.Media { outputStream.Write(buffer, 0, length); } outputStream.Dispose(); + + inputStream.Position = 0; // Rolling back the stream so external readers will have it easier. } ///