Allow user to upload only one file with Plupload

multi_selection=false limits user from selecting more than one file per once and max_file_size limits, how large file can be. But, is there anyway with Plupload to allow user to send only one file at all?

I only want to use Plupload as AJAX-uploader and reuse its chunking feature. I'm not interested at all in its ability to upload more than one file at once. I know, that I can block it (limit transfer to just one file) on server side, but this will happen after transmission has been made.

Is there any way to limit upload to just one file on client side, before any actually file transfer occurs?

Answers


The only solution, I came up with, is to use events, write your own code for QueueChanged event:

QueueChanged: function(up) {
    function(uploader)
    {
        if(uploader.files.length > 1)
        {
            uploader.files.splice(1, uploader.files.length);

            apprise('You can not add more than one file!', {});
        }
    }
}

and put this into init section of Plupload Queue widget configuration (or bind this particular event with uploader.bind, if using simple, core UI version of Plupload).


Need Your Help

Is there any way to set up TeamCity agents to run on a round robin schedule?

build teamcity

We are building several project with TeamCity. In addition to an agent on the main server which runs on Linux, we also have three additional agents that run on separate boxes. One on Linux, one o...

How to make Postgresql Hstore work with rails 4 on ubuntu

ruby-on-rails postgresql ruby-on-rails-4 pg hstore

So I read a few articles that I found in google how to make hstore make with Rails 4, and as it happens, it wasnt that easily as it was told so I decided to describe the steps that I had to take to...