File got corrupted and size is increased when uploading after publishing code on AWS Lambda function with .NET Core 3.1

Viewed 242

I'm Uploading mp3 file in aws s3 bucket, when i upload from my local system its working fine and uploading file with same size. but after publishing on AWS, when i try to upload file, file getting corrupted and also file size is increased. Here is my API : I'm just returning file from here.

[HttpPost, DisableRequestSizeLimit]
    [Route("SaveSoundRecordingDataFile")]
    public async Task<IActionResult> SaveSoundRecordingDataFile()
    {
        try
        {
            var file = Request.Form.Files[0];
            return Ok(file);
        }
        catch (Exception ex)
        {
            return StatusCode(500, $"Internal server error: {ex}");
        }
    }

Check below responses I'm uploading 1MB size file you will find how file size are getting increased after publish code on aws lambda.

Response from Local System :

Response from local system

Response after publish on aws lambda :

Response from aws

I have tried many ways and go through many articles and forms but didn't find any solution why is this happening. Thank you in advance.

0 Answers
Related