Filepond: Multiple file uploads Callback.

Created on 3 Feb 2019  路  4Comments  路  Source: pqina/filepond

When workin 'allowMultiple` is there a callback when all files have been uploaded successfully?

Most helpful comment

i implemented it like this:

    function getUploadStatus(){
      var totalFiles = $('.filepond--item').length;
      var completedFiles = $('.filepond--item[data-filepond-item-state="processing-complete"]').length;
      console.log('totalFiles: '+totalFiles);
      console.log('completedFiles: '+completedFiles);
      if(completedFiles == totalFiles){
        alert('done');
      }
    }
pond.onprocessfile = (error, file) => {
            if (error) {
                console.log('Oh no');
                return;
            }
            getUploadStatus();
        }

All 4 comments

Hi, there currently is not, you鈥檇 have to check if all files are processed when a new file is processsd.

Hey rik.
First, thank you for the nice uploader.

Second, is there any function I can query to get the items in the queue and the status of those?

i implemented it like this:

    function getUploadStatus(){
      var totalFiles = $('.filepond--item').length;
      var completedFiles = $('.filepond--item[data-filepond-item-state="processing-complete"]').length;
      console.log('totalFiles: '+totalFiles);
      console.log('completedFiles: '+completedFiles);
      if(completedFiles == totalFiles){
        alert('done');
      }
    }
pond.onprocessfile = (error, file) => {
            if (error) {
                console.log('Oh no');
                return;
            }
            getUploadStatus();
        }

To add to this, you can use the item.status property and then compare it using the FilePond. FileStatus enum.

// is queued
file.status === FilePond.FileStatus.PROCESSING_QUEUED

// is complete
file.status === FilePond.FileStatus.PROCESSING_COMPLETE

As the problem has been fixed I'll close the issue.

Was this page helpful?
0 / 5 - 0 ratings