首页 > 解决方案 > 如何从 html 调用 Laravel 函数?

问题描述

我想要这个html代码

<div class="form-group">
    <label for="company_policy_file_path">Policy File Path<span class="required"> : (Required Field)</span></label>
    <input id="company_policy_file_path" type="text" name="file_path" class="form-control" placeholder="Please Enter the file path" />
</div>

将文件上传到后端并执行此 laravel 功能

<?php
    echo Form::open(array('url' => '/uploadfile','files'=>'true'));
    echo 'Select the file to upload.';
    echo Form::file('image');
?>

谁能给我关于如何实现这一目标的建议?

标签: phplaravel

解决方案


{{Form::open(['url' => '/uploadfile', 'files' => true])}}

<div class="form-group">
    {{Form::label('company_policy_file_path', 'Policy File Path<span class="required"> : (Required Field)</span>')}}
    {{Form::text('file_path', '', ['id' => 'company_policy_file_path', 'class' => 'form-control', 'placeholder' => 'Please Enter the file path'])}}
</div>

<div class="form-group">
    {{Form::label('image', 'Select the file to upload.')}}
    {{Form::file('image', array('id' => 'image'))}}
</div>

<div class="form-group">
    {{Form::submit('Save', ['class' => 'btn btn-success'])}}
</div>

{{Form::close()}}

推荐阅读