Hi,
I've searched the forum but still unsure how to set the file_upload_limit dynamically using the ASP.Net example in the demos.
For example, I want to limit the user to ten images. They upload 4 so i then need to change the limit to 6 etc.
If anyone can let me know the easiest way to set this dynamically that would be great. I will be checking their limit against my DB.
Thanks in advance for any help.
Depends what you mean
I assuming you mean dynamically setting the file upload limit between page refreshes because 1) SWFUpload keeps track of the upload count during one page session (this is list of the page is refreshed) and 2) you can change the page session upload limit using setFileUploadLimit.
This means you need to track the upload count on the server side and then when you build the page pass the limit to SWFUpload:
Code Behind:
protected int uploadLimit = TotalAllowedUploads - TotalCompleteUploads;
HTML:
var swfu = new SWFUpload({
file_upload_limit: <%=uploadLimit%>,
/* more settings not shown in this sample code */
});
Be sure that you still verify the upload limit on the server side in your upload handling code. Also remember that setting file_upload_limit to zero (0) means "unlimited" so you'll need some logic that prevents SWFUpload from displaying and shows the user a message about exceeding their quota or whatever you want to do.