I need to upload an mp4 video file from iPhone/iPad to a server, also in the background, so I read that is possible with URLSession.uploadTask(with: URLRequest, from
Sometimes it is easier for the server to read file from form-data. For instance, the flask framework can read file uploaded in the format of form-data easily by request.files. Alamofire provides an easy way to do this
AF.upload(multipartFormData: { multipartFormData in
multipartFormData.append(FilePath, withName: FilePath.lastPathComponent)
}, to: url).responseJSON { response in
debugPrint(response)
}
In this way, the file will be uploaded in the format of form-data.