使用laravel将图像上传到数据库的问题

时间:2014-10-12 11:30:29

标签: php symfony laravel-4

所以我想上传和图片,我的观点如下:

<form action="" class="dropzone" enctype="multipart/form-data" method="post" id="my-awesome-   
dropzone">
       <div class="default message">
            <div class="col-lg-1">
                <input type="file" id="image" class="file-pos" name="image">
                <br />
                <button class="btn btn-theme" name="upload" type="submit">Upload your 
                portfolio</button>
            </div>
        </div>  
</form>

我控制器中的代码如下所示:

public function uploadPortfolio()
{
        $userid = Auth::user()->id;
        $image = new Image();
        $image = Input::file('image');
        $file_name = Input::file('image')->getClientOriginalName();
        $upload_folder = '/assets/uploads/portfolio/';
        $image->move(public_path() . $upload_folder, $file_name);
        $image->save(array('image' => $file_name));
        return Redirect::to('/users/uploadPortfolio');
}

我得到的错误是:Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException 据我所知,这是我的路由问题,但即使我把回复评论我仍然得到这个错误。有人知道我做错了吗?

0 个答案:

没有答案