1
當我上傳了Azure存儲圖像,我做了這樣上傳圖像Azure存儲
let storageAccount : AZSCloudStorageAccount;
try! storageAccount = AZSCloudStorageAccount(fromConnectionString: config.getAzureConnection())
let blobClient = storageAccount.getBlobClient()
var container : AZSCloudBlobContainer = (blobClient.containerReference(fromName: config.getImagesContainer()))
modelName = UIDevice.current.modelName
let ticks = Date().timeIntervalSince1970 * 1000
let imageName: String = "\(modelName)-\(ticks).png"
let blob: AZSCloudBlockBlob = container.blockBlobReference(fromName: imageName)
let imageData = UIImagePNGRepresentation(pickedImage)
blob.upload(from: imageData!, completionHandler:{(NSError) -> Void in
})
但是在Azure存儲的內容類型保存應用程序/八位字節流,而不是圖像/ PNG。我上傳圖片時如何更改內容類型?
應該是'blob.properties.contentType' – ridvankucuk
這個工程,謝謝 – HideCode