Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera uno-de-piera/Component.vue Secret
Last active Jun 10, 2019

What would you like to do?
<div role="form">
<div class="form-group">
<label class="btn btn-primary">
<i class="fa fa-folder-open-o" aria-hidden="true"></i>&nbsp;Seleccionar un archivo
<input type="file" accept=".pdf" @change="onFileSelected" name="myfile">
export default {
name: "my-component",
methods: {
onFileSelected (event) {
const file =[0];
const formData = new FormData();
formData.append("my-file", file);`server-url`, formData, {
headers: {
'Content-Type': 'multipart/form-data'
.then(res => {
//todo ok
error => {
//todo mal :P
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.