Working with encrypted files in Laravel (how to download decrypted file)

前端 未结 2 780
广开言路
广开言路 2021-02-02 04:19

In my webapp, users can upload files. Before being saved and stored, the contents of the file are encrypted using something like this:

Crypt::encrypt(file_get_co         


        
2条回答
  •  故里飘歌
    2021-02-02 04:45

    Laravel 5.6 allows you to use streams for downloads: https://laravel.com/docs/5.6/responses#file-downloads

    So in your case:

    return $response()->streamDownload(function() use $decryptedContents {
        echo $decryptedContents;
    }, $fileName);
    

提交回复
热议问题