Hello,
This is laravel. I wonder why after pressing, Upload Image button nothing happen. I doubt that it even pass the controller. Any clue?
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 method="post" enctype="multipart/form-data" action="{{ URL::to('/home/upbprofile') }}">
<input type="hidden" name="_token" id="_token" value="<?php echo csrf_token() ?>">
<div class="modal-body">
<input type="file" name="b_pic">
</div>
<div class="modal-footer">
<input type="submit" value="Upload Image" class="btn btn-primary" data-dismiss="modal">
</div>
</form>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
routes.php
Route::post('/home/upbprofile', 'SettingController@UploadBackgroundProfile');
SettingController.php
public function UploadBackgroundProfile(Request $request)
{
$b_pic = $request->file('b_pic');
dd($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');
}