Вызов функции-члена getRealPath() для строки"

Я хочу отправить письмо после отправки формы со всеми данными и с вложением (файл, изображение). Я предполагаю, что он возвращает строковое значение. как решить эти вопросы.

Контроллер.php

  $fileNameToStore= $filename.'_'.time().'.'.$extension;
            //upload image
            $path = $request->file('file')->storeAs('Circularfs',$fileNameToStore);
            //dd($path);
        }else{
            $fileNameToStore = 'noimage.jpg';
        }
            $cfile = new circularfs;
            $cfile->title = $request->input('title');
            $cfile->department = $request->input('department');
            $cfile->file = $fileNameToStore;
            $cfile->save();

            $to_email = "[email protected]";
            \Mail::to($to_email)->send(new \App\Mail\circularfs($cfile));

Скриншот ошибки App\Mail\circularfs.php находится здесь


person priya gupta    schedule 06.02.2019    source источник


Ответы (1)


Можете ли вы показать код вашей формы здесь? Вы используете этот enctype="multipart/form-data" или "files"=>true?

<form method="POST" action="http://example.com" enctype="multipart/form-data">
</form>

 {!! Form::open(['url' => route('myRoute'), 'method' => 'post', 'files' => true]) !!}
person Iqbal Butt    schedule 06.02.2019
comment
{!! Form::open(['url' =› route('Circularfs.store'), 'method' =› 'post', 'files' =› true]) !!} используя это - person priya gupta; 06.02.2019
comment
Сделайте var_dump($request-›file('file')); - person Iqbal Butt; 06.02.2019
comment
-›attach($this-›cfile['file']-›getRealPath(), [...] я получаю сообщение об ошибке в этой строке, и да, я dd($cfile) в конструкторе данных файла customemail.php приходят - person priya gupta; 06.02.2019
comment
вывести ответ var_dump($request-›file('file')); - person Iqbal Butt; 06.02.2019