dimanche 26 juin 2016

Laravel AWS Download

I started a new project via Laravel 5.1 and came to the part where I need to download a file with s3 (AWS). Never before do it and I noticed that keeps files in xml format.

I hired a guy to finish everything concerning s3, but he does not know how to download file.

Controller

//$key = urldecode($key);


//This way found file as .xml but can't get zip file?!
$key = str_replace('.zip', '.xml', $firmware->key);
$test = Storage::disk('s3')->get('db/'.$key);

//dd($test);  this get: 
FileNotFoundException in FilesystemAdapter.php line 58:
db/Toshiba\07GAH\TOSHIBA MK8007GAH-BG002H0-Y6HNW0EOW.xml*

$data = (array) simplexml_load_string($test) or die("Can't read XML for $manifest");
//dd($data);
//dd($test);

return  response()->download('db/'.$data['key']);

This is error in browser when in db change "\" in "/" enter image description here

Please help and take consideration that I not worked with s3 so I need a little more detailed answer Tnx



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire