文件上传在laravel中始终返回NULL

时间:2019-04-29 07:46:20

标签: laravel

我要上传文件,这是我的控制器:

$uploadFile = $request->file("document");
dd($request->file("document"));
$path = $uploadFile->store('storage/files');

这是我的表单操作:

<form class="form-horizontal" action="{{route('mto-post')}}" method="post" enctype="multipart/form-data" files="true">
    {{ csrf_field() }}

..........................................

<td class="pt-3-half">
    <div class="form-group">
        <label for="document">Document</label><br>
        <input type="file" name="document">
        <small class="form-text text-muted">Harap Masukan Featured Image Yang Ingin Digunakan.</small>
    </div>

但是,当我 dd($ request-> file(“ document”));

总是返回 NULL

这是结果$ request-> input()

   array:13 [▼
  "_token" => "P3jR5AzMe4jPPeEud24Tdue0LPOc1zFcgR5viEcW"
  "txtWorkOrder" => "23iy4837t5"
  "txtDocNumber" => "34iwugru3j4gr4u"
  "txtLocation" => "8327y8"
  "tanggal" => "2019-04-08"
  "txtItemCode" => array:3 [▶]
  "txtDescription" => array:3 [▶]
  "txtSpek" => array:3 [▶]
  "txtUnits" => array:3 [▶]
  "Cat" => array:3 [▶]
  "txtRequiredQty" => array:3 [▶]
  "txtSpareQty" => array:3 [▶]
  "action" => "draft"
]

我的代码有什么问题? 任何帮助将不胜感激。 谢谢

0 个答案:

没有答案