vendredi 14 octobre 2016

How to download a pdf file from storage laravel

I just saw a few tutorials about Laravel storage, but I can't understand how can I create a link for the user to download the actual file that was uploaded.

I managed to upload a pdf file to:

storage/app/public/ccf/b443e9db8dc05f503ede6e670c34bf92.pdf.

I ran the artisan command: php artisan storage:link

But I can't understand what url I should put in the link for the user to download the file.

I tried:

<?php
        $path1 = asset('storage/public/ccf/b443e9db8dc05f503ede6e670c34bf92.pdf');
        $path2 = storage_path('ccf/b443e9db8dc05f503ede6e670c34bf92.pdf');
        $path3 = Storage::url('b443e9db8dc05f503ede6e670c34bf92.pdf');
    ?>

    <a href="" target="_blank">Path1</a>
    <a href="" target="_blank">Path2</a>
    <a href="" target="_blank">Path3</a>

None work.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire