public async Task <ActionResult> UploadImage(string type) { HttpContext.Request.Cookies.TryGetValue("uid", out string user); HttpContext.Request.Cookies.TryGetValue("token", out string token); var auth = new Dictionary <string, string>() { { "uid", user }, { "token", token } }; var file = Request.Form.Files.FirstOrDefault(); //Give file a GUID as a name var id = Guid.NewGuid().ToString(); //upload that file _imageService.UploadFile(file, id); //get that profileimage linked to user await _imageService.AddProfileImage(auth, id); return(Ok()); }