Laravel 文件上传只上传.tmp文件

Laravel file upload just uploads .tmp file

出于某种原因,这在我看来不起作用:

{!! Form::open(['url'=>'notes','file'=>true]) !!}

所以我只是使用了这个似乎让我更进一步:

{!! Form::open(['url'=>'notes','enctype'=>'multipart/form-data']) !!}

在我的 PostsController 的存储方法中,我有以下内容:

    $file = Input::file('picture');
    $file->move(public_path(). /pictures/');

当我尝试上传 .jpeg 文件时,一个 .tmp 文件被上传到正确的文件夹中,但它只是一个 .tmp 文件,上面写着:

"The file cannot be displayed in the editor because it is either binary, very large or uses and unsupported text encoding."

不确定为什么不上传 .jpeg 文件本身。

你可能想试试这个

$file = Input::file('picture');
$destinationPath = public_path(). '/pictures/';
$filename = $file->getClientOriginalName();

Input::file('picture')->move($destinationPath, $filename);
        if ($request->file('photo')) {
        $destinationPath = "packages/.../img/media/";

        if (!is_dir($destinationPath)) {
            mkdir($destinationPath, 0777, true);
        }
        $final_location = $destinationPath . "/";
        $request->file('photo')
        ->move($final_location, filename.'.'. $request->file('photo')
        ->getClientOriginalExtension());
        }