ios - Image uploading from gallery to server -
this code in ios. trying upload images user picking gallery server. image uploaded while opening image in cpanel junk in printing.on button click calling function. func myimageuploadrequest() {
if (imageview.image == nil) { return } let image = uiimagejpegrepresentation(imageview.image!, 1) let parameters = ["image": "image", "mime":"jpeg"] alamofire.upload(multipartformdata: { multipartformdata in multipartformdata.append(image!, withname: "imageview",filename: "file.jpeg", mimetype: "image/jpeg") (key, value) in parameters { multipartformdata.append(value.data(using: string.encoding.utf8)!, withname: key) } }, to:"https://www.xxxxx.in/xxxxxx/newfileupload.php") { (result) in switch result { case .success(let upload, _, _): upload.uploadprogress(closure: { (progress) in print("upload progress: \ (progress.fractioncompleted)") }) upload.responsejson { response in print(response.result.value any) } case .failure(let encodingerror): print(encodingerror) } }
Comments
Post a Comment