Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
Transmisión de archivos a través del servidor php desde amazon s3

Me gustaría transmitir un archivo desde S3 al navegador del cliente usando PHP. Podría lograrlo, pero tengo un problema con los archivos grandes. Primero, toma toda la memoria disponible para la sesión y termina con un error de "Memoria agotada". En segundo lugar, cuando llega a "fread(...)" por primera vez, se cuelga casi 1 minuto para un archivo de 50Mo antes de comenzar a enviarlo al navegador. ¿Cómo puedo manejar estos 2 problemas? Aquí está mi código.

 $client->register_stream_wrapper(); if($stream = fopen('s3://' . S3_BUCKET . '/' . $destination_s3, 'r')) { //Send file to browser. header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Cache-control: no-store"); header("Pragma: no-cache"); header("Content-Disposition: attachment; filename=$file_name"); header("Content-Type: " . $file_type); while (!feof($stream)) { echo fread($stream, 1024); flush(); } fclose($stream); }
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!