Sopamo / laravel-filepond

Laravel backend module for filepond uploads
MIT License
204 stars 54 forks source link

Allow to specify input name #71

Open abudawud opened 1 year ago

abudawud commented 1 year ago

Add input name filed with modifying the filepond ondata method. Here is the example

FilePond.create(document.querySelector('input.photo-file'), {
    labelIdle: 'Drag & Drop Gambar Varietas atau <span class="filepond--label-action"> Browse </span>',
    acceptedFileTypes: 'image/*',
      server: {
        url: "{{ route('filepond.chunk') }}",
        process: {
            url: '/process',
            ondata: function (form) {
                form.append('input_name', 'photo_file');
                return form;
            }
        },
        revert: '/process',
        patch: "?patch=",
        headers: {
          'X-CSRF-TOKEN': '{{ csrf_token() }}'
        }
      }
})

Refer to: https://pqina.nl/filepond/docs/api/server/#object-configuration

Solve issue #67