A question about the quasar framework uploader component. I need to post the images to a URL that will rename the uploaded file and return the full path.
I\'m usin
I have successfully done uploading of the file to python API.
V1 Update
Use @added -> function(files)
method.
This is the component:
<q-uploader
url=""
extensions=".gif,.jpg,.jpeg,.png"
@add="file_selected"
/>
<q-btn @click="uploadFile()">Upload</q-btn>
Data:
data() {
return {
selected_file:'',
check_if_document_upload:false
}
}
Methods
file_selected(file) {
this.selected_file = file[0];
this.check_if_document_upload=true
},
uploadFile(){
let fd = new FormData();
fd.append("file", this.selected_file);
axios.post('/uploadFile',fd,{
headers: { 'Content-Type': undefined},
}).then(function (response) {
if (response.data.ok) {
}
}.bind(this));
}
This is working fine for me.