laravel框架——上传、下载文件
文件上传
在config文件夹下新建一个 项目名.php
return [
‘title‘ => ‘My Test‘,
‘posts_per_page‘ => 5,
‘uploads‘ => [
‘storage‘ => ‘local‘,
‘webpath‘ => ‘/uploads‘, //上传文件存放的目录 在public文件夹下
],
];
view视图代码
{{--如果要上传文件,必须要在Form里面设置files为true--}}
{!! Form::open(array(‘url‘=>‘create/show‘,‘files‘=>true)) !!}
{{--name为iamge--}}
{!! Form::file(‘image‘) !!}
<br />
{!! Form::submit(‘提交‘) !!}
{!! Form::close() !!}
//必须使用这个Request use Illuminate\Http\Request;
文章来自:http://www.cnblogs.com/xj76149095/p/5610912.html