Prepend the files to upload using the blueimp jquery plugin instead append them

215 Views Asked by At

I'm using this plugin to upload files to my website https://github.com/blueimp/jQuery-File-Upload

When the page is loaded, by default I show all the images already uploaded. Using this code:

$j('#showUploadedImages').on('click', function() {
$j.ajax({
    url: '/upload/server/php-general-images/',
    dataType: 'json',
    context: $j('#fileupload')[0],
    data: 'userID=' + $j('#userID').val()
}).always(function () {
    $j(this).removeClass('fileupload-processing');
}).done(function (result) {
    $j(this).fileupload('option', 'done')
    .call(this, $j.Event('done'), {result: result});
});
});

Actual behaviour: When I add more images to upload, these images are shown at the bottom of the list (with the "Start" button, to start the upload of that image).

Request: I want to show the images to upload at the top of the list (instead the bottom)

Reason: When I've uploaded many images (Ex. 500) the list become long, and when I'll add more images, I have to scroll-down all the list until the bottom to just click the "Start" button of the new images to upload.

1

There are 1 best solutions below

0
Ömer An On

In jquery.fileupload-ui.js file, change the below line to true:

// By default, files are appended to the files container.
// Set the following option to true, to prepend files instead:
prependFiles: true,