'Web Api Return File with additional data

I'm returning a file as follows:

  public async Task<IActionResult> GetFile(string id)
        {
            try
                {
                    GetFileDataResponse retrieveResponse = new GetFileDataResponse();                
                    retrieveResponse = GetFileData(Int32.Parse(id));

                    var folderName = Path.Combine("Resources", "Images");
                    var pathToSave = Path.Combine(Directory.GetCurrentDirectory(), folderName);
                    pathToSave = Path.Combine(pathToSave, retrieveResponse.FileUrl);
                    var fileName = Path.GetFileName(pathToSave);
                    var content = await System.IO.File.ReadAllBytesAsync(pathToSave);
                    new FileExtensionContentTypeProvider()
                        .TryGetContentType(fileName, out string contentType);
                    return File(content, contentType, fileName);

                }
                catch(Exception ex)
                {
                response.Success = false;
                response.Message = ex.ToString();
                return BadRequest() ;
                }
        }

Is there a way to send some data additional besides the file?

I want to send some data like "uploadedBy:1", but I don't know if this is possible, I read about some parameter in the content disposition but I'm not sure how to implement it.

Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source