如何在控制器中检查输入类型文件或隐藏在laravel中

时间:2015-10-02 00:44:34

标签: php laravel

如何从视图中检查控制器中的输入类型文件或隐藏在laravel中。

    @if(isset($input_data['list_image_filename1']))
        <label for="list_image_filename1">{{ $input_data['list_image_filename1'] }}</label>
        <input type="hidden" name="list_image_filename1" value="{{ $input_data['list_image_filename1'] }}">
    @else
        <input class="form-control" name="list_image_filename1" type="file" id="list_image_filename1">
    @endif

1 个答案:

答案 0 :(得分:0)

public function processForm(Request $request)
{
    if ($request->file('list_image_filename1')) {
        //  it's file input
    } elseif ($request->has('list_image_filename1')) {
        // it's hidden input
    }
}