编辑表单时,上传的文件未进入上传字段

时间:2018-07-17 05:32:42

标签: laravel edit laravel-blade

  <div class="control-group">
          <label class="control-label">Publication Type</label>
          <div class="controls">
            <select name="publication_type" id="publication_type">
              <option value="Circular"  @if($publicationDetails->publication_type=="Circular") selected @endif >By Circular</option>
              <option value="Law"  @if($publicationDetails->publication_type=="Law") selected @endif >By Law</option>
            </select>
          </div>
        </div>
       <div class="control-group">
          <label class="control-label">Publication File</label>
          <div class="controls">
            <input type="file" name="publication_file" id="publication_file"  value="{{ $publicationDetails->publication_file }}"/>
          </div>
        </div>
        <div class="form-actions">
          <button type="submit" class="btn btn-success">Update</button>
        </div>

image to clearify you about my edit blade structure and where I want file name

2 个答案:

答案 0 :(得分:0)

您的表单标签中有enctype='multipart/form-data吗?

<form method="post" action="/url" enctype='multipart/form-data'>

答案 1 :(得分:0)

由于您正在使用<input type='file'/>,因此将代码包装在<form> ... </form>标记内。如果您有足够的经验,您可能会发现<input type='email'/>不在form打开和关闭标记之间,将不起作用。试试看。它可能会起作用,否则可能会出现一些CSS问题。有时CSS会阻止默认的html操作。