Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

443
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda