3

I have a problem. I have autoUpload set to false within $('element').fineUploaderDnd();

I can drag and drop files just fine. However, I can't seem to figure out how to manually trigger the upload. I have tried both of the following:

var uploader = $('#droppable').fineUploaderDnd(/*{ ... }*/);
uploader.fineUploaderDnd('uploadStoredFiles'); //Doesnt work
uploader.fineUploaderDnd('addFiles', handleUploads.fineUploaderFiles); //Also doesnt work

Note that handleUploads.fineUploaderFiles is an array of the 'File' objects the plugin returns to me .on('processingDroppedFilesComplete')

They both give me errors saying they don't support that. I've also tried various methods of using both the Dnd thing for drag/drop and the normal jquery fineUploader for 'addFiles' but that also doesn't seem to work.

What am I missing?

1 Answer 1

2

These lines aren't going to work:

uploader.fineUploaderDnd('uploadStoredFiles'); //Doesnt work
uploader.fineUploaderDnd('addFiles', handleUploads.fineUploaderFiles); //Also doesnt work

Because you can only call the uploadStoredFiles and addFiles methods on instances of FineUploader. It appears you are calling these methods on instances of the DnD module.

There are no such options in the standalone Fine Uploader DnD module. The standalone drag-and-drop module doesn't upload anything. It is meant to be used alongside FineUploaderBasic mode instance (note that you can use it outside of Fine Uploader entirely if you want to). This module is provided for FineUploaderBasic users who want to integrate drag & drop support easily into their app. If you are using FineUploader mode, drag & drop is already integrated for you, however.

To achieve this in basic mode

First, add an instance of FineUploader:

var uploader = $("#uploader").fineUploader({ uploaderType: 'basic' /*, ... */ })

Next, add an upload button:

var uploadButton = $("#upload-button").on('click', function () {
    $("#uploader").fineUploader('uploadStoredFiles');
});

Then, instantiate your drag and drop module (note that this is separate from FineUploader's instance!):

var dnd = $('#droppable').fineUploaderDnd({
     /* custom options */            
}).on('processingDroppedFilesComplete', function (event, files) {
    uploader('addFiles', files); //this submits the dropped files to Fine Uploader
});

For reference, please see the following:

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the response. I didn't realize the DnD module is supposed to be used in combination with the Basic module. In terms of your answer, what is fineUploaderBasicInstance supposed to be? I tried setting that to both $('#uploader') as well as $('#uploader').fineUploader({uploaderType: 'basic'}), but neither seem to work.
@Jeff, my fault. Instead of fineUploaderBasicInstance it should be either uploader or $("#uploader").fineUploader
turns out it was a little different for the jQuery version, I had to use $('#uploader').fineUploader('addFiles', files);. That worked perfectly. Thanks for your help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.