laravel - 文件上传总是在 laravel 中返回 NULL
问题描述
我想上传文件,这是我的控制器:
$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"
]
我的代码有什么问题?任何帮助将不胜感激。谢谢
解决方案
推荐阅读
- javascript - 值为 null 的对象属性被视为 ''
- amazon-web-services - 使用 dynamoDB 和用户组进行细粒度访问
- azure-ad-b2c - 如何刷新 Azure AD B2C (Angular) SPA 会话数据?
- sql-server - 使用 T-SQL 的 ReportServer 数据库中的 SSRS 站点 URL
- eclipse-plugin - 如何在 SWT 中将背景图像设置为外壳或合成
- nsis - 在 Windows 启动时使用 NSIS 安装程序启动打包的 exe
- c# - 如何使照片片段可点击 asp.net web 应用程序
- c++ - 读取文件数据到结构
- kubernetes - 入口路径重定向,掌舵图
- sql-server - 带有 EXEC master.dbo.xp_cmdshell 的 ZIP 文件