/// base64上传图片 /// ///成功上传返回上传后的文件名 [HttpPost] public async TaskUpLoadImageBase64() { HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"]; string text = context.Request.Form["file"]; Stream stream = new MemoryStream(Convert.FromBase64String(text.Split(',')[1])); using (HttpClient client = new HttpClient()) { var request = new HttpRequestMessage(HttpMethod.Post, ConfigurationManager.AppSettings["Imgaes"].ToString() + "/Upload"); var content = new MultipartFormDataContent(); //client.DefaultRequestHeaders.Add("fileext", HttpContext.Request.Headers["fileext"]); content.Add(new StreamContent(stream), "file", "file.jpg"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); var filenamestr = await response.Content.ReadAsStringAsync();//返回结果 } return Ok(); }