简体   繁体   English

使用blueimp jquery插件在文件之前上传,而不是在文件上附加

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

I'm using this plugin to upload files to my website https://github.com/blueimp/jQuery-File-Upload 我正在使用此插件将文件上传到我的网站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. 原因 :当我上传了许多图像(例如500)时,列表变长了,当我添加更多图像时,我必须向下滚动所有列表,直到底部,只需单击菜单栏中的“开始”按钮即可。上载新图像。

In jquery.fileupload-ui.js file, change the below line to true : jquery.fileupload-ui.js文件中, jquery.fileupload-ui.js更改为true

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM