Support the ongoing development of Laravel.io →
Configuration Database Views
Last updated 1 year ago.
0

What errors do you get?

What are you passing as pdf_file

Your path looks wrong if your pdfs are in public

0

elite123 said:

What errors do you get?

What are you passing as pdf_file

Your path looks wrong if your pdfs are in public

yeah i don't know what the problem is i used if i changed it to public/image/pdf the error would be

file_get_contents(public/image/pdf/var/www/fsr/storage): failed to open stream: No such file or directory

it has var/www/fsr/storage

0

This code is useful for every extension of file, will show. just change your path as per your storage dir

 /**
     * @param  int $id
     * @param  string $docs
     * @return \Illuminate\Http\Response
     */

..public function showTenderDocs($id, $docs)
 ..{
        ..$filename = "/images/tender_docs/".$id.'/'.$docs;
        ..$path = base_path($filename);
        ..$contentType = mime_content_type($path);
        ..return Response::make(file_get_contents($path), 200, [
           .. 'Content-Type' => $contentType,
            ..'Content-Disposition' => 'inline; filename="'.$filename.'"'
        ..]);

    ..}

Last updated 7 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

taneoboy taneoboy Joined 6 Feb 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.