在vue.js中我有这个:
var data = new FormData();
data.append('name',this.property_credentials.name);
data.append('default_image',this.$els.fileIntroImage.files[0]);
当我这样做时,我有价值观:
console.log('default_image',data.get('default_image'));
但问题是,当我尝试在控制器中获取值时,我得到null:
$intro_image = $request->input('default_image');
有任何建议如何从表单数据中获取控制器中的值?
编辑:
this.$http.put('/profile/'+ user_id +'/property/'+ property_id +'/edit', data).then(function(response) {
$("html, body").animate({ scrollTop: 0 }, "slow");
this.property_status = true;
this.property_success_update_message = response.data.successUpdateMsg;
} , function(response) {
$("html, body").animate({ scrollTop: 0 }, "slow");
this.property_status = false;
this.property_errors = response.data
});
答案 0 :(得分:0)
使用file()方法$intro_image = $request->file('default_image');