How to Limit Plupload to Only One File

I’ve been using plupload a lot lately. Some fun projects at work, at home… Especially since WordPress has added it to the core — good move — it’s been my goto upload solution.

The only problem with plupload, as far as I can see, is that there is no file upload limit setting for restricting the number of files a user can upload.

Here’s the quick and dirty solution that limits the files to 1. It can be easily adapted for more.

The guts of the solution is line #3. It says: When a new batch of files are added if that new batch has more than 1 file in it, remove all but the first file of that batch.


Leave a Reply