Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel 4将图像上载到服务器_Php_Image_Laravel - Fatal编程技术网

Php Laravel 4将图像上载到服务器

Php Laravel 4将图像上载到服务器,php,image,laravel,Php,Image,Laravel,我正试图上传图像到laravel,我遇到了一些问题:S 我的看法是: <form role="form" method="post" action="{{url('admin/test')}}" id="formm" > <input type="file" placeholder="browse" id="imagen_item" name="imagen_item" accept="image/*"/> <input type=

我正试图上传图像到laravel,我遇到了一些问题:S

我的看法是:

<form role="form" method="post" action="{{url('admin/test')}}" id="formm" >
        <input  type="file" placeholder="browse" id="imagen_item" name="imagen_item" accept="image/*"/>
        <input type="submit" style="font-size: 20px" class="btn btn-primary" value="Guardar">
</form>
我的控制器

public function test()
{
    $file = Input::file('imagen_item');
    var_dump($file);
    $destinationPath = 'uploads/';
    if(is_object($file))
    {
        $filename = $file->getClientOriginalName();
        $upload_success = Input::file('imagen')->move($destinationPath, $filename);
        if( $upload_success ) {
            echo 'save this url: '.$filename." in the DB";
        }
    }
}
以及我在提交表格后得到的信息:

null
A
A.A
很明显,问题在于我没有从输入表单中读取图像。。但是为什么呢??我有相同的名字。。。谢谢大家!

解决了! 我将表单标记更改为:

    {{ Form::open(array('url' => 'admin/rnew_item', 'files' => true,'id'=>'formm')) }}
以及ofc的:

    {{ Form::close() }}
    {{ Form::close() }}