我想使用 swift 4 将图像文件发送到服务器。我所做的是`
var editProfile_image_path = NSTemporaryDirectory() + "temp.jpg"
Just.post(
"http://justiceleauge.org/member/register",data: ["username": "abc", "password":"test"],files: ["product_image" : .url(URL(fileURLWithPath: editProfile_image_path), nil)]) { r in
if r.ok { } }
do {
try UIImageJPEGRepresentation(self.profileImgvw.image!, 0.8)!.write(to: URL(fileURLWithPath:self.editProfile_image_path), options: .atomicWrite)
} catch let error as NSError {
print(error)
}
非常感谢帮助,我想要的是将图像文件发送到服务器。请帮我。