我正在尝试上传图像,但每次提交时都会返回 store() 为 null 错误。我已将表单设置为 enctype="multipart/form-data" 这并没有帮助。
任何人都可以指出我正确的方向吗?
谢谢。
控制器内部功能
public function store(Request $request){
$file = $request->file('imgUpload1')->store('images');
return back();
}
Run Code Online (Sandbox Code Playgroud)
表格如下:
<form action="/imgupload" method="POST" enctype="multipart/form-data">
{{ csrf_field() }}
<div class="form-group">
<label for="imgUpload1">File input</label>
<input type="file" id="imgUpload1">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
Run Code Online (Sandbox Code Playgroud) 我试图在照片信息 5 之后隐藏 div。不确定下面的脚本是否正确执行。如果有人能给我任何指导,那就太好了。
jQuery
$( ":nth-of-type(5)" ).nextAll( ".photo-info" ).addClass( "hidden" );
Run Code Online (Sandbox Code Playgroud)
HTML
<div class="photo-info">1</div>
<div class="photo-info">2</div>
<div class="photo-info">3</div>
<div class="photo-info">4</div>
<div class="photo-info">5</div>
<div class="photo-info">6</div>
<div class="photo-info">7</div>
Run Code Online (Sandbox Code Playgroud) protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
$image = new Image;
$image->current_step = 'step1';
$image->isCompleted = '0';
$image->save();
}
Run Code Online (Sandbox Code Playgroud)
每当用户首次注册时,我都希望将一堆数据输入到另一个表中.用户可以正常注册,但每当我检查数据库时,其他表中都没有.
这是朝着正确的方向发展的吗?
谢谢
CircularCountDown.prototype = {
init: function () {
this.formatData();
this.draw();
this.start();
},
start: function () {
if (typeof this.data.beforeStart == "function") {
this.data.beforeStart(this);
}
this.show();
this.starDecrementTimeEvent();
var time = this.getFormattedTimeByCircle();
this.animate(time);
},
starDecrementTimeEvent: function () {
var that = this;
console.log(that);
this.decrementTimeEvent = setInterval(function () {
that.time -= 1;
that.setTime(that.getStringTime(that.time));
if (that.time <= 0) {
that.time = 0;
that.stopDecrementTimeEvent();
if (typeof that.data.end == "function") {
that.data.end(that);
}
}
}, 1000);
},
stopDecrementTimeEvent: function () {
clearInterval(this.decrementTimeEvent);
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用插件进行循环计时器,我希望调用stopDecrementTimeEvent函数来停止不同JS文件中的计时器.我不熟悉如何以这种格式调用它.
任何指导都会很棒,谢谢.