I have looked into it. It is a little bit complex than expected. We need to keep a count in the Activity Uploader instance and check when files are Added ( ‘FilesAdded’ event of plupload) to see if we have already adedd n number of files. We may not check the size of queue as the upload starts as soon as a file is selected.
I will need to modify this inside the core to avoid any future issue.
Since you need it by 1st september, I have got 2 days left, I will do my best to have it. I was trying to implement Accept Terms feature for upload and was facing almost identical issue, so please allow me to target in the core itself.
I have pushed a change in may last commit that will allow you to restrict the number of uploads.
And here is an implementation of it(code is commented)
You can check the size of the queue using
hope that gives you enough to work with it.
That is it, works perfect.
There is just one small issue. I restricted upload to 3 photos. When I try to restrict upload to 4 photos, I fire a message with limit of photos and after that I try to upload 3 photos but queue length is 7 (4+3) instead of 3 and upload doesn’t start. I temporarily “bypassed” this issue with page reload the page and with that I reset the queue. 🙂
Thank you for the reply and confirming.
Another way to deal with it is to reset the queue using plupload API.
The ‘up’ object is an instance of plupload Uploader, so we can use all its methods there.
Here is the link to their API.
Hope that helps.
PS: I will be away for around 10 hours and my apologies in advance for any delay in reply.
The topic ‘ [Resolved] Max number of photos per one post’ is closed to new replies.