0
Setting.blade.php上傳文件不能正常工作
<div id="myModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Please input a new background</h4>
</div>
<form action="{{ action('[email protected]') }}" method="post">
<div class="modal-body">
<input type="file" name="b_pic">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Upload Image</button>
</div>
</form>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
控制器/ SettingController.php
public function UploadBackgroundProfile(Request $request)
{
$b_pic = $request->file('b_pic');
if ($b_pic != NULL)
$b_pic->move('uploads/bgprofile', $b_pic->getClientOriginalName());
if ($b_pic != NULL)
{
// simpan yg baru
$model->bgprofile = $b_pic->getClientOriginalName();
}
$model->save();
return view('soulfy.setting');
}
你好,
在印刷機上載圖片我希望將所選圖像複製到所選文件夾。但它不,我想知道爲什麼?它不能正常工作,就像什麼都沒有發生。
您應該在form標籤中使用enctype =「multipart/form-data」屬性 –