I don’t see an option in the plupload API docs on restricting the number of files uploaded, to any number, even 1.
Doc fail? or Feature fail? If it doesn’t exist I’ll be working on making that happen if anyone needs it..
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s a feature fail. I made a wrapper around the jQuery API and this is what I did to make it work for me. My code does some other business logic, but it should give you enough to set started.
Basically, bind to the
FilesAddedevent and callremoveFileon the uploader object (if there are too many files). I think I added the 50ms timeout because it was giving me problems with the file not existing yet.max_file_countis something that I add to the pluploader instance when I create it.Edit: I actually had to do two different ways for this. The above will only allow a person to upload a certain number of files (and generate an error otherwise).
This snippet works in a similar way – but will remove existing files and only upload the most recent: