I am uploading image file on azure server with below code which successfully upload the file. (i can see it on server)
self.manager.upload(multipartFormData: { (multipart) in
multipart.append(fileData, withName: "file",fileName: "uploading.png" , mimeType: "image/png")
}, to: url.description, method: .put, headers: ["x-ms-blob-type":"BlockBlob","Content-type": "multipart/form-data","Content-Disposition" :"form-data"]) { encodingResult in
switch encodingResult {
case .success(let upload, _, _):
upload.response { answer in
print("statusCode: \(String(describing: answer.response?.statusCode))")
comp(true,"Documnet Uploaded Successfully")
}
upload.uploadProgress { progress in
//call progress callback here if you need it
}
case .failure(let encodingError):
print("multipart upload encodingError: \(encodingError)")
comp(false,"Unable to Upload the documnet")
}
}
But when i download the file (manually or by code). The image is not getting open. It say's
It may be damaged or use a file format that Preview doesn’t recognise.
When i Open the file in NotePad. Below lines are appearing on top in every uploaded image. File is 'OKAY' without these lines. I don't know why these are added every time automatically.
--alamofire.boundary.5243a11a13e8a8f4
Content-Disposition: form-data; name="file"; filename="uploading.png"
Content-Type: image/png
Please suggest solution.