I would like to implement the removal of some images from the upload list before uploading. Basically, before uploading, I would like to go through the dimensions of each image, and remove the images that do not satisfy certain criteria. I'm able to access the properties of each image via UploadItems, but I fail to remove any of them with the Remove() method as documented. If I did so, IE6 will crash. :'(

Does anybody has any luck doing this successfully? The built-in checking like MinImageWidth, MaxImageHeight are not sufficient for our purpose.

Thanks for the reply. I just found what would trigger the bug: if the Layout is TwoPanes then IE will crash once I've done one or two operations Removal(). Conceptually, Removal() should deselect an image, but in TwoPanes layout it will (incorrectly) remove the image from the right panel. Or, is there any function that is able to deselect an image in TwoPanes layout?

Thanks for the efficient work! I have downloaded & tested the fixed version. It works perfectly.

By the way, Alex has suggested some fix to avoid double checks. I've considred the performance issue during coding. I observe the following properties of the UploadFileCountChange() event: 1) The uploaded file will be included into the upload list one by one (internally), and the event will be fired for each file. Say, you've selected 6 files (not yet checked), and you click a tickbox to check all 6 files. In this case, the event will be fired for 6 times (each for every file added) instead of once (once for all 6 files). 2) The new file added can sit at any position in the UploadItems property, depending on the sequence the files were selected.Based on this I've modified the code as follows:

I can safely put a 'break' (instead of 'i--;' or leaving it empty) there because the event will be fired again for the next file. So 'break' should typically be able save more time than using 'i--'. Since the newly added file can be in any position in the UploadItems, we need to use a for() loop to iterate all the files in the upload list just to have a check on the newly added file.

This bring up a performance issue. Suppose that I want to select 100 images. In the worst case, all images are accepted, and in this case the for() loop will be iterated for 1+2+3+...+100=5050 times! In the best case, all images are rejected, and the iteration runs for 1+1+1+...+1=100 times. Is there any way I can reduce the iteration time with the current ImageUploader interface?

I can safely put a 'break' (instead of 'i--;' or leaving it empty) there because the event will be fired again for the next file

Yes, you are right in your case. But UploadFileCountChange event doesn't always fired for each item. For example in three panes mode when user drags files to upload pane UploadFileCountChange event is fired only once. You have to take it into account while making UploadFileCountChange event handlers.

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.