我想用laravel 3上传多个文件到服务器,但是怎么上传呢?查看代码:
{{ Form::open_for_files() }}
{{ Form::label('imgs', 'Image') }}
<input name="imgs[]" type="file" multiple="" />
{{ Form::label('', '') }}
{{ Form::submit('submit', array('class' => 'submit')) }}
{{ Form::close() }}路由代码:
Input::upload('imgs', 'public/uploads' , 'abc.jpg');但它不起作用。请帮帮忙。
发布于 2013-02-15 21:18:58
我认为,你应该在foreach循环中这样做:
$files = Input::file();
foreach($files as $key=>$file)
{
Input::upload("imgs[$key]", 'public/uploads' , "img_$key.jpg");
}发布于 2013-04-07 08:21:20
这就是我在我的应用中做的事情,(由symfony的http基金会处理)
foreach((array) Request::foundation()->files->get('file') as $file) {
$file->move('save_path', 'new_name');
}上传字段的名称应为'name="file[]"‘
https://stackoverflow.com/questions/14880761
复制相似问题