调用一个成员函数getRealPath()的字符串”

问题描述 投票:0回答:1

我想所有的数据和附件(文件,图像)提交表格后发送邮件。我想它返回字符串值。如何解决这个问题。

Controller.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错误截图是这里

laravel-5.7 laravel-mail
1个回答
0
投票

你能告诉你的表单代码在这里?您是否使用这个ENCTYPE = “的multipart / form-data的” 或 '文件'=>真的吗?

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

 {!! Form::open(['url' => route('myRoute'), 'method' => 'post', 'files' => true]) !!}
© www.soinside.com 2019 - 2024. All rights reserved.