Rank: Newbie
Groups: Member
Joined: 7/18/2011(UTC) Posts: 6
Thanks: 1 times
|
Hello
I need to restrict the number of files to be uploaded to 10. I have set the code to: <Restrictions FileMask="*.pdf;*.jpg;*.jpeg;*.bmp;*.png;*.gif" MaxFileCount="10" />
which works.
Also the MaxFileCount gets changed based on the number of files already uploaded. I have used: fleUploader.Restrictions.MaxFileCount = maxFileCount - currentFileCount;
to set the MaxFileCount. But this does not work, and any number of files can be uploaded.
Any quick help is appreciated.
Thanks
|
|
|
|
Rank: Advanced Member
Groups: Joined: 7/13/2011(UTC) Posts: 286
Thanks: 6 times Was thanked: 31 time(s) in 31 post(s)
|
Hello, Please try to use Uploader.BeforeUpload Event so you can check conditions whether uploading is allowed or not. If you return "false" from handler of this event, uploading process is stopped. Edited by user Tuesday, July 26, 2011 10:36:07 PM(UTC)
| Reason: Not specified |
Best regards, Pauline Shirykalova Aurigma Technical Support
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 7/18/2011(UTC) Posts: 6
Thanks: 1 times
|
The above event will only help if the maxFileCount has exceeded 10. How about allowing uploading only a limited number of files: fleUploader.Restrictions.MaxFileCount = maxFileCount - currentFileCount;
|
|
|
|
Rank: Advanced Member
Groups: Joined: 7/13/2011(UTC) Posts: 286
Thanks: 6 times Was thanked: 31 time(s) in 31 post(s)
|
Hello, I'm not sure I understand your needs right. If you want your users to upload not more than 10 files at one time, maxFileCount=10 will work for you. maxFileCount property limits the number of files to be uploaded in a single session. This means that if user selects 10 files, than tries to select some more files, Image Uploader wouldn't even let him select extra files. Next time user will be allowed to upload 10 more files. If you want your users to upload not more than 10 files to your site (I mean once he has uploaded 10 files, he will never be able to upload more), you should implement your own algorithm, the main idea is: 1. You declare some variable which contains the information about the number of files uploaded by a single user (particular user). 2. Implement your Uploader.BeforeUpload event, where you check whether the value of this variable is less than 10 or it exceeds it. If exceeds - user is not allowed to upload, you return false. 3. Implement your Uploader.AfterUpload event, where you reduce the value of your variable by the number of just uploaded files. Hope this is helpful. If you have any additional questions please feel free to ask. |
Best regards, Pauline Shirykalova Aurigma Technical Support
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.