laravel控制器的上载脚本

时间:2019-05-13 12:42:15

标签: laravel laravel-5 laravel-5.6 laravel-controller

我已经尝试过一些教程,但是它总是给我一条错误消息。如何制作一个控制器脚本以在laravel中上传文件?

请举个例子

$judul = htmlentities($request->post('judul'));
    $mdes = htmlentities($request->post('meta_des'));
    $kon = htmlentities($request->post('konten'));
    $mkey = htmlentities($request->post('meta_key'));

    $file = $request->file('gambar');
    $name = 'photo-at-'.date('Y-m-dH:i:s').'.'.$file->getClientOriginalExtension();
    $path = $file->storeAs('imag e',$name);

    return dd($path);

    $tgl = date('Y-m-d');

    DB::table('article')->insert([
        'judul' => $judul,
        'pitcures' => date('dmY').'_PITCURE',
        'konten' => $kon,
        'meta_des' => $mdes,
        'meta_key' => $mkey,
        'tanggal_tulis' => $tgl
    ]);


    return redirect('/admin/articles.index');

错误消息?

fopen(C:\x\htdocs\public\image/photo-at-2019-05-1311:56:57.dll): failed to open stream: No such file or directory

仅此而已!

0 个答案:

没有答案