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