pqina / vue-filepond

🔌 A handy FilePond adapter component for Vue
https://pqina.nl/filepond
MIT License
1.92k stars 128 forks source link

The component send empty request to server #216

Closed anscharivs closed 2 years ago

anscharivs commented 2 years ago

Hi. I'm having problems to use the component with Laravel. When I upload some file, the request is always empty ([]). Is this a bug or some problem with my config? because I'm no te only one with this issue.

My config:

<template>
    <div>
        <file-pond
            :server="server"
            name="archivos"
            ref="pond"
            class-name="my-pond"
            label-idle="Drop files here..."
            allow-multiple="true"
            accepted-file-types="image/jpeg, image/png, application/pdf"
            :files="files"
            :instantUpload="false"
            @init="handleFilePondInit()"
        />
    </div>  
</template>
<script>
    // Imports
    export default {
        name: 'ComponentName',
        data() {
            return {
                files: [],
                server: {
                    url: 'http://my-site.test',
                    process: {
                        url: '/upload/store',
                        method: 'POST',
                        withCredentials: true,
                        headers: {
                            'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content
                        },
                        onload: (response) => console.log(response),
                        onerror: (error) => console.error(error),
                        ondata: (data) => console.info(data)
                    }
                },
            }
        },
        methods: {
            handleFilePondInit: function () {
                console.log('FilePond has initialized');

                // example of instance method call on pond reference
                this.$refs.pond.getFiles();
            },
        },
        components: {
            FilePond,
        },
    };
</script>

My POST route is correctly configured. When I return the content of the $request in server is always [].

rikschennink commented 2 years ago

You can check network tab in dev tools to see what is posted to your server.

I'll close the issue as it doesn't conform to the issue template.


We require the issue template to be filled out on all new issues. The issue template helps us collect all the information we need to address your submission efficiently.

If your issue can be classified as an integration question or a question about specific features of FilePond we ask you kindly to submit it on Stack Overflow.

We will be able to more closely look at your issue once the issue template has been filled out. The issue will be closed until the above is addressed.

Please leave a comment after you've updated the issue.