0

working with Laravel 9. but when I try to send contact page form submit form it is encountered following error messages as well. Swift_IoException Unable to open file for reading [/home3/abc/abc/public/images/logo.png]

Swift_ByteStream_FileByteStream::getReadHandle
vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php:131

in my localhost this is working fine but this is happening in the live hostgrator server.I have following code segment in veryfyUser.blade.php to sending attachment with email

<img src="{{ $message->embed(public_path('images/logo.png')) }}" alt="" style="width: 300px; max-width: 600px; height: auto; margin: auto; display: block;">

I dont konw what is the problem? could you give me some solutions here

amaruwakoi
  • 43
  • 1
  • 7
  • Does `/home3/abc/abc/public/images/logo.png` exist and is it readable? `ls -l /home3/abc/abc/public/images/logo.png` – aynber Apr 26 '23 at 13:50
  • @aynber what did you mean sir? I cant understand – amaruwakoi Apr 26 '23 at 14:01
  • Does `/home3/abc/abc/public/images/logo.png` on hostgator? Did you upload the image when you uploaded your project? – aynber Apr 26 '23 at 14:03
  • yes it is in the server – amaruwakoi Apr 26 '23 at 14:06
  • If you have shell access to the server (which I know hostgator provides), log in and do `ls -l /home3/abc/abc/public/images/logo.png`. What does it show? – aynber Apr 26 '23 at 14:07
  • in the server my public folder like public_html – amaruwakoi Apr 26 '23 at 14:09
  • Look at the error message, it's trying to access `/home3/abc/abc/public/images/logo.png` on HostGator. If the file is not in that path, and `public_html` is in your correct path, then obviously Laravel cannot find it with `public_path()`. You'll need to fix your Laravel pathing or hard-code the path to the image. – aynber Apr 26 '23 at 14:11
  • okay if I am change public_html folder as public in the server is it okay? – amaruwakoi Apr 26 '23 at 14:17
  • That's a question you'd have to have with HostGator. I would expect no, because that's how their webserver is set up, but definitely check. Otherwise, there's a few articles out on the web about setting up Laravel on a shared host – aynber Apr 26 '23 at 14:19
  • https://stackoverflow.com/questions/55094509/how-to-point-laravel-project-to-a-public-folder-under-public-html-in-shared-host might also be helpful – aynber Apr 26 '23 at 14:20

0 Answers0