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

158
Views
Laravel 5.4: carga de archivos en aws s3 directamente al depósito

Estoy tratando de cargar un archivo en el depósito de AWS s3

 public function fileTest(Request $request) { //this will create folder test inside my bucket and put the contents $request->file->store('test','s3'); }

Pero el código anterior creará una carpeta llamada test dentro de mi depósito y colocará el archivo en ella.

Pero quiero subir directamente al cubo

 $request->file->store('s3');

Probé el código anterior pero no funcionó.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Resolvió mi problema con el siguiente

 $s3 = Storage::disk('s3'); $s3->put('',$request->file);

Taquigrafía

Storage::disk('s3')->put('',$request->file)

over 4 years ago · Santiago Trujillo Report

0

public function uploadFile (Request $request) { $file = $request->file('file'); $imageName = 'uploads/' . $file->getClientOriginalName(); Storage::disk('s3')->put($imageName, file_get_contents($file)); Storage::disk('s3')->setVisibility($imageName, 'public'); $url = Storage::disk('s3')->url($imageName); return Response::json(['success' => true, 'response' => $url]); }
over 4 years ago · Santiago Trujillo Report

0

Pon tu archivo en el servidor s3

 $agreement_contract_copy = $request->file('agreement_contract'); $filename = $id. '/agreement' . '_' . time() . '.pdf'; $student->agreement_copy = $filename; $student->save(); Storage::disk('s3')->put($filename, file_get_contents($agreement_copy));

Si no puede definirlo como público, por defecto su tienda es privada y cuando usa un método privado, en el archivo que obtiene el tiempo se usa el método temporal como se muestra a continuación. Obtenga su archivo

 Storage::disk('s3')->temporaryUrl ($student->agreement_copy, \Carbon\Carbon::now()->addMinutes(5))

$estudiante->acuerdo_copia

Probado

over 4 years ago · Santiago Trujillo Report
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!