我使用 WinZip 创建了一个 zip 文件。我可以使用 WinZip 和 Windows 资源管理器打开它。
然后我将此文件上传到 Azure 存储,然后再次下载。
我可以在 Windows 资源管理器中打开下载的文件,但 WinZip 说它已损坏。
我使用的是 Windows 8.1 和最新版本的 Winzip。这在开发和生活环境中都会发生。这里有什么问题?
更新 14/01/2014 这是我使用的代码
Private Sub UploadDocumentToAzure(filename As String, _
ByRef stream As Stream)
Dim storageAccount As CloudStorageAccount = CloudStorageAccount.Parse(Microsoft.WindowsAzure.CloudConfigurationManager.GetSetting("StorageConnectionString"))
Dim blobClient As CloudBlobClient = storageAccount.CreateCloudBlobClient
Dim container As CloudBlobContainer = blobClient.GetContainerReference("cont")
container.CreateIfNotExists()
Dim blockBlob As CloudBlockBlob = container.GetBlockBlobReference(filename)
blockBlob.UploadFromStream(stream)
End Sub
Public Sub DownloadDocumentFromAzure(documentName As String, ByRef response As HttpResponse)
Dim storageAccount As CloudStorageAccount = CloudStorageAccount.Parse(Microsoft.WindowsAzure.CloudConfigurationManager.GetSetting("StorageConnectionString"))
Dim blobClient As CloudBlobClient = storageAccount.CreateCloudBlobClient
Dim container As CloudBlobContainer = blobClient.GetContainerReference("cont")
Dim blockBlob As CloudBlockBlob = container.GetBlockBlobReference(documentName)
Dim memStream As New MemoryStream
blockBlob.DownloadToStream(memStream)
response.ContentType = blockBlob.Properties.ContentType
response.AddHeader("Content-Disposition", "Attachment; filename=""" & blockBlob.Name.ToString() & """")
response.AddHeader("Content-Length", (blockBlob.Properties.Length - 1).ToString())
response.BinaryWrite(memStream.ToArray())
response.End()
End Sub