%PDF- %PDF-
Direktori : /home/ugotscom/3vfm3/resources/js/components/ |
Current File : /home/ugotscom/3vfm3/resources/js/components/mfileupload.vue |
<template> <div class="card"> <div class="card-header"></div> <div class="card-body"> <div v-if="success != ''" class="alert alert-success"> {{success}} </div> <form @submit="formSubmit" enctype="multipart/form-data" class="upload-form"> <div class="form-group"> <label for="">File Name</label> <input type="text" class="form-control" name="name" v-model="file_name"> </div> <div class="form-group"> <label for="">File Type</label> <select name="" id="" v-model="type" class="form-control"> <option value="1">Quote</option> <option value="2">Re Quote</option> <option value="3">Others</option> </select> </div> <div class="form-group"> <h4>Upload a file from your computer</h4> <input type="file" class="form-control" v-on:change="onChange"> </div> <button class="btn btn-primary">Upload</button> </form> </div> </div> </template> <script> export default { data() { return { name: '', file_name: '', success: '', type:'', id:'', }; }, methods: { onChange(e) { this.file = e.target.files[0]; }, formSubmit(e) { e.preventDefault(); let existingObj = this; const config = { headers: { 'content-type': 'multipart/form-data' } } let data = new FormData(); data.append('file', this.file); data.append('type', this.type); data.append('file_name', this.file_name); axios.post('/document/fileupload', data, config) .then(response => { this.$toaster.success('File Uploaded'), this.$root.$emit('bv::toggle::collapse', 'add-file') }) // this. loadactivities() }, updatestatus: function () { axios.post('/maintenance/updatestatus',{ id:this.id, status:4, }) .then(response => { this.$toaster.success('File Uploaded Successfully'); }) window.location.reload() }, }, } </script>