I try to upload image from gallery with several parameter to server but can't find any sample usefull because most of them are deprecated. don't know where to start.
func uploadImageAndData(){
       let periode = periodeField.text
       let kode_wilayah = kodeWilayahField.text
       let nama_petugas = namaPetugasField.text
       let upload_file = myImageView.image
        var parameters = [String:AnyObject]()
        parameters = ["periode":periode,
                      "kode_wilayah":kode_wilayah,
                      "nama_petugas":nama_petugas,
                      "uploaded_file": upload_file] as [String : AnyObject]
        let URL = "myURL"
        Alamofire.upload(
            multipartFormData: { (multipartFormData) in
                if let imageData = upload_file?.jpegData(compressionQuality: 0.3){
                    multipartFormData.append(imageData, withName: self.myFileName)
                }
        }, to:URL)
        { (result) in
            switch result {
            case .success(let upload, _ , _):
                upload.uploadProgress(closure: { (progress) in    
                    //print("uploding")
                    print("Upload Progress: \(progress.fractionCompleted)")
                })  
                upload.responseJSON { response in
                    debugPrint(response)
                    print("done")
                    print(response.result.value)   
                }    
            case .failure(let encodingError):
                print("failed")
                print(encodingError)  
            }
        }
    }
And this in from image picker function and no problem with choosing image from gallery.
@objc func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
myImageView.image = info[UIImagePickerController.InfoKey.originalImage] as! UIImage
            let data = image.pngData()! as NSData
            data.write(toFile: localPath!, atomically: true)
            let photoURL = URL.init(fileURLWithPath: localPath!) 
        }
        self.dismiss(animated: true, completion: nil)  
    }
I can get the path but can't give it to upload function. I really appreciate for your help.