0

I got an error from FPDI setSourceFile. It shows that fopen() cannot find file or directory. I tried to access pdf template from database that I saved using Storage facade link, I think it's stored on /public/storage directory. Been using some helper like asset(), url(), and Storage::disk('public')->path(''). Still get the error. Any solution?

AlphaRabid
  • 17
  • 4
  • Well, have you tried asking the PDF nicely to open up and let you access it? Maybe offer it a cup of coffee or a snack? Jokes aside, have you checked if the file path is correct? Maybe it's playing hide and seek with you. – Wahyu Kristianto Mar 17 '23 at 17:01
  • What a nice of you, thx for answering. I checked the path before `setSourceFile` function running. I dd it, it was correct, but it was accessing the `/storage` path not `/public`, which as far as I know, the storage path can't have read access or smth. – AlphaRabid Mar 18 '23 at 08:00
  • Run `php artisan storage:link`. Once a file has been stored and the symbolic link has been created, you can create a URL to the files using the `asset` helper. – Wahyu Kristianto Mar 18 '23 at 10:01
  • Yup, been doing that. Using `asset()` is solving the issue of `setSourceFile`. I think I've solved it before i post the question. I encountered new error. But for this question context is solved. Thx a lot brother. – AlphaRabid Mar 19 '23 at 09:03

0 Answers0