views:

175

answers:

2

Not sure if you guys are familiar with YUI Uploader, but after you click "browse" and select a bunch of files, the callback event returns a list of all the files that are queued, not just the ones you just finished selecting. This poses a bit of a problem because now instead of just adding the selected files to the UI, you have to clear the list and re-add them all. You can't even compute the difference between the existing files, and all the files, because their file id's are randomly changed too, as with the order of the files in the queue. This slows down the UI because it has to re-add stuff that was already there, and confuses the user as all their stuff is randomly reordered. How have people dealt with this? Would it be logical to sort the files by filename to maintain some sort of consistency (even though adding to the end would be more logical), or has anyone devised some complex solution to figure out which files were actually selected in the last operation?

A: 

Im using yahoo uploader, but dont understand exactly what you meaning, you can order files the way you want, every time the user select a file you can insert with javascript in the top of the div, span or whatever you are using, and for example what you can do for avoid a user select the same file you can save the event.fileList.fileNUBER in array and compare everytime the onselect event goes on.

nahum
fileNuber? I Assume you mean "number"... is that unique, or does it change when you try uploading the same file twice? And it's slow to compare every number in one list, to every number in another list. Yes, you can insert the files anywhere, but if you re-add the whole list, they randomly get shuffled. Unless you filter out the dupes and add the remainder, you end up with a mess.
Mark
+1  A: 

in current version of YUI files added to event.fileList to the end of list with progressing IDs and not shuffling their order. take a look at their multi-file upload example. It even continues numbering order if you remove some files from beginning of queue.

Konstantin Salavatov
I found an alternate solution since I posted that, but I'll take your word on it that they fixed YUI. That's good to know!
Mark