H
H
Herman Martin2019-09-24 22:35:50
Laravel
Herman Martin, 2019-09-24 22:35:50

How to change the name of the given file on the fly in Laravel?

I store the filename and realname fields from the database, the second of them is generated automatically, when downloading it is issued

public function download(Document $document){
        //return $document;
        $pathToFile = storage_path()."/app/".$document->realname;
        return response()->download($pathToFile);
    }

how to influence the file name that is given for downloading? need a tip

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Wells, 2019-09-24
@dklight

Don't have an IDE? Put.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question