I have uploaded the pdf link on website and when clicked on link it's not showing pdf file.

Posted 1 month ago by me10071990

view

{{ $post->content }}

Controller

public function show($id)

{

    $file=Post::find($id);

    $content = base64_decode($file->content);

    return response($content)->header('Content-Type', $file->file);

}

public function store(Request $request) {

if (request('file'))

{

    $file = request('file');

    $file_name = time() . $file->getClientOriginalName();

    $file->move('uploads/posts', $file_name);

    $data['file'] = 'uploads/posts/'.$file_name;

}

}

Please sign in or create an account to participate in this conversation.