Post

Replies

Boosts

Views

Activity

Problem converting image to base64
Hello there, I'm trying to convert an image into base64 encode, however when I try to Upload it to server using Alamofire it failes with no error.I'm using Xocde 8.3.3 and here is my code.func submitSale() { let url : String = "http:/ let imageDataPNG : Data = UIImagePNGRepresentation(UIImage(named: "japanvillage")!)! let imageDataJPEG : Data = UIImageJPEGRepresentation(UIImage(named: "japanvillage")!, 80)! let imageStrPNG = imageDataPNG.base64EncodedString() let imageStrJPEG = imageDataJPEG.base64EncodedString() let stringBase64 = imageStrJPEG.replacingOccurrences(of: "+", with: "%2B") Alamofire.request(url, method: .post, parameters: updateInfo, encoding: JSONEncoding.default).responseJSON { response in ...is there any one could help ?
3
0
4.4k
Jul ’17