嘿,我想从IOS (swift3)上传图像到JSP服务,并将图像保存在web服务存储中(如果在web -inf中会更好)和mysql数据库的路径,任何人都可以帮助我这个或发送给我一个例子
不管怎样,谢谢你
发布于 2017-01-24 20:15:10
对于Swift部分,通常的方法是将您的图像转换为base64String
let image = UIImage(named:"test")
// Convert to PNG if you need lossless
if let pngBase64String = UIImagePNGRepresentation(image)?.base64EncodedString() {
// upload pngBase64String to server
}
// or Convert to JPG
let jpegCompressionQuality: CGFloat = 0.9
if let jpgBase64String = UIImageJPEGRepresentation(image, jpegCompressionQuality)?.base64EncodedString() {
// Upload jpgBase64String to server
}https://stackoverflow.com/questions/41827729
复制相似问题