mardi 23 janvier 2018

Customizing the name of an uploaded .zip file in Laravel

My Laravel app accepts user-submitted .zip files, which I temporarily store in local storage:

Storage::disk('local')->put('exports', $request->custom_report_url);

The challenge is that this creates a file with what I assume is some kind of hash:

'app/storage/exports/U44SEhM1wycNgMU0bV6qieSRiGJwMPvkDpBDgkyo.zip'

This makes that zip file a pain to find later in the process.

Is there a way that I can define a custom name for that zip file? Ideally, I'd like to do something like:

Storage::disk('local')->put('exports/export_' . $export-id . '.zip', $request->custom_report_url);`

However, when I run that code, it creates the following filepath:

'app/storage/exports/export_1.zip/U44SEhM1wycNgMU0bV6qieSRiGJwMPvkDpBDgkyo.zip'

Close, but not what I need. Any ideas?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire