Perform the post request manually to be able to send the folder id with it

parent db0d5150
......@@ -20,14 +20,19 @@
:on-remove="handleRemove"
:on-success="handleSuccess"
:file-list="fileList"
:headers="requestHeaders"
:http-request="uploadFile"
style="display: inline-block; margin-right: 10px;">
<el-button size="small" type="primary" style="padding: 11px 9px;">Upload File</el-button>
</el-upload>
</template>
<script>
import axios from 'axios'
export default {
props: {
parentId: {type: Number}
},
data() {
return {
fileList: [],
......@@ -49,6 +54,16 @@
this.$events.emit('fileWasUploaded', response);
this.fileList = [];
},
uploadFile(event) {
let data = new FormData();
data.append('parent_id', this.parentId);
data.append('file', event.file);
axios.post(route('api.media.store'), data)
.then(response => {
this.fileList = [];
this.$events.emit('fileWasUploaded', response);
});
},
handleRemove() {},
},
mounted() {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment