Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

442
Visualizações
How to upload Excel to Amazon S3 using AWS Lamda and dotnet Core 5?

So i am using AWS Lamda project to upload excel file to S3. It got upload on S3 but issue is it got corrupted once uploaded. It is working fine on local but when i deploy it to AWS it does not work.

Below is my code.

Controller.cs

IFormFile file = Request.Form.Files[0];
UploadtoS3("Test", file, file.FileName);

UploadtoS3 Method

UploadtoS3(string bucketName, IFormFile file, string fileName)
{
    System.IO.Stream MyStream = file.OpenReadStream();
            
    PutObjectRequest request = new PutObjectRequest
    {
       BucketName = bucketName,
       Key = fileName,
       InputStream = MyStream,
       ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"                    
    };

    PutObjectResponse response = await _client.PutObjectAsync(request);
}

AWS API Gateway

I have also added possible binary types.

enter image description here

Please help. Thanks in Advance

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Faced with a similar problem. In my case, the redeployment stage for the api helped

Also updated LambdaProxyFunction

  protected override void Init(IWebHostBuilder builder)
{
  builder
      .UseStartup<Startup>();
        
  RegisterResponseContentEncodingForContentType("multipart/form-data", ResponseContentEncoding.Base64);
  RegisterResponseContentEncodingForContentType("application/vnd.ms-excel", ResponseContentEncoding.Base64);
  RegisterResponseContentEncodingForContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", ResponseContentEncoding.Base64);
  RegisterResponseContentEncodingForContentType("application/vnd.ms-excel.sheet.macroEnabled.12", ResponseContentEncoding.Base64);

    }
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda