无法在laravel中打开文件以读取错误

时间:2019-07-12 06:59:34

标签: php html sql laravel

我在laravel中有一个表单,该表单将数据发送到电子邮件和数据库,我试图将表单中的图像存储在公用文件夹中,然后发生以下错误

  

无法打开文件以阅读[/hermes/walnaweb08a/b1307/as.book/TEIA/storage/app/public/1562913994bannernew.jpg]

在以下针对swiftmailer的代码中发生了错误

 private function getReadHandle()
    {
        if (!isset($this->reader)) {
            $pointer = @fopen($this->path, 'rb');
            if (!$pointer) {
                throw new Swift_IoException('Unable to open file for reading ['.$this->path.']');
            }
            $this->reader = $pointer;
            if (0 != $this->offset) {
                $this->getReadStreamSeekableStatus();
                $this->seekReadStreamToPosition($this->offset);
            }
        }
 
        return $this->reader;
    }

这是我的sendmail.php

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use App\Register;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class SendEmail extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
   public $sub;
    public $msg;
    public $phot;
    public $rec;
    public $sig;
    public function __construct($subject,$message,$photo,$recipt,$sign)
    {
       $this->sub = $subject;
       $this->msg = $message;
       $this->phot = $photo;
       $this->rec = $recipt;
       $this->sig = $sign;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        
       $b_subject = $this->sub;
        $b_message = $this->msg;
        $reg = Register::where('id',$b_message)->first();
        $b_phot = $this->phot;
        $b_phot = $this->phot;
        $recipt = $this->rec;
        $sign = $this->sig;
        return $this->view('mail.sendmail', compact("reg","b_phot","sign","recipt"))->subject($b_subject);
    }
}

图像存储在文件夹中,并且数据已发送到数据库,但是问题是发生此错误,并且数据未发送到邮件。谁能告诉我问题出在哪里

0 个答案:

没有答案