Failing to Upload Picture with multipart/form-data to a Server
I've read quite a lot of topics here on multipart/form-data . It still doesn't work. I am able to upload a file to my server with URLSession.shared.uploadTask . class MainViewController: UIViewController { @IBOutlet weak var pictureView: UIImageView! @IBAction func postTapped(_ sender: UIButton) { postData() } func postData() { var request = URLRequest(url: URL(string: "http://www.mywebsite.com/upload.php")!) request.httpMethod = "POST" request.timeoutInterval = 30.0 guard let imageData = UIImagePNGRepresentation(pictureView.image!) else { print("oops") return } let uuid = UUID().uuidString