سلام خدمت دوستان
من می خواستم با استفاده از vue و لاراول اپلود تصویر انجام بدم.
در حال حاضر اطلاعات دیگه به خوبی ذخیره میشود اما فایل تصویر خیر .
لطفا اگر کد در مورد اپلود تصویر با لاراول و ویو دارید بفرستین و اگر راهنمایی هست ممنون میشم کمکم کنید.
@ali.bayat
@juza۶۶
@hesammousavi
@Alimotreb
کد ویو برای ذخیر و ویرایش input های دیگر
"
data: {
items: [],
hasError: true,
hasDeleted: true,
hasAgeError: true,
showModal: false,
e_name: '',
e_age: '',
e_id: '',
e_profession: '',
newItem: { 'name': '','age': '','profession': '' },
},
mounted: function mounted() {
this.getVueItems();
},
methods: {
getVueItems: function getVueItems() {
var _this = this;
axios.get('/readitemss').then(function (response) {
_this.items = response.data;
});
},
setVal(val_id, val_name, val_age, val_profession) {
this.e_id = val_id;
this.e_name = val_name;
this.e_age = val_age;
this.e_profession = val_profession;
},
createItem: function createItem() {
var _this = this;
var input = this.newItem;
if (input['name'] === '' || input['age'] === '' || input['profession'] === '' ) {
this.hasError = false;
} else {
this.hasError = true;
axios.post('/vueitems', input).then(function (response) {
_this.newItem = { 'name': '', 'age': '', 'profession': '' };
_this.getVueItems();
});
this.hasDeleted = true;
}
},
editItem: function(){
var i_val_۱ = document.getElementById('e_id');
var n_val_۱ = document.getElementById('e_name');
var a_val_۱ = document.getElementById('e_age');
var p_val_۱ = document.getElementById('e_profession');
axios.post('/edititems/' + i_val_۱.value, {val_۱: n_val_۱.value, val_۲: a_val_۱.value,val_۳: p_val_۱.value })
.then(response => {
this.getVueItems();
this.showModal=false
});
this.hasDeleted = true;
},
deleteItem: function deleteItem(item) {
var _this = this;
axios.post('/vueitems/' + item.id).then(function (response) {
_this.getVueItems();
_this.hasError = true,
_this.hasDeleted = false
});
}
}
});
"
لطفا راهنمایی بفرمایید
شاید پاسخ شما همینجا باشد
چرا از dropzone استفاده نمیکنی؟