How to change file_upload_limit dynamicly?

Hi,
In my webapp I allow the user to upload up to 3 files at once.
The user can delete the files he uploaded at the same page with Ajax.
If for example the user uploaded 3 files and removed 1 without postback,
he will get the file_upload_limit error if he tries to upload another file.
Is there a way to change file_upload_limit?
Or maybe subtract the file_upload_limit count.
Thanks
SirMoreno

gyphie's picture

2 Ways

There are 2 ways. You just need to read the included documentation:

Call the setFileUploadLimit(###) method

or

Use setStats to decrease the successful upload count

E.g.:
var stats = this.getStats();
stats.successful_uploads--;
this.setStats(stats);

Thanks

.