吃鸡游戏
如果您使用 Base64 或 Byte[] 发送文件对象,那么它只允许限制可能高达 2-4 Mb,但如果您的图像比它更大,它将不支持。因此,解决方案是发布流内容,例如,var file = await CrossMedia.Current.PickPhotoAsync(new PickMediaOptions { PhotoSize = PhotoSize.Full, CompressionQuality = 100 });创建类似MediaFile的对象,public MediaFile AttachedImage;并将文件存储到其中,这样内存流就不会丢失。喜欢,AttachedImage = fileAPI上的邮政编码,HttpClient httpClient = new HttpClient();MultipartFormDataContent mt = new MultipartFormDataContent();AttachedImage.GetStream().Position = 0;StreamContent imagePart = new StreamContent(AttachedImage.GetStream());imagePart.Headers.Add("Content-Type", ImageType);mt.Add(imagePart, String.Format("file"), String.Format("bk.jpeg"));requestMessage.Content = mt;var response = await httpClient.PostAsync("Your URL", mt);if (response.IsSuccessStatusCode){ var responseString = await response.Content.ReadAsStringAsync(); var objRootObjectuploadImage = JsonConvert.DeserializeObject<RootObjectuploadImage>(responseString); if (objRootObjectuploadImage != null) { } else { }}else{ Loading(ActIndicator, false); await DisplayAlert(res.LAlert, "webserver not responding.", res.LOk);}