0 Replies Latest reply on Oct 27, 2011 9:06 AM by madhooper

    attempting to check for duplicates

    madhooper Level 1

      The user can browse and select files.I'm trying to make sure the file isn't already listed in their datagrid (previous selection).


      refAddfiles is the list of the currently selected files.

      dupArrList is where i want to put the dups so i can list them in an alert message

      _arrUploadFiles is the dataprovider for my datagrid and array of previously selected files.


      here's my code


      private function onSelectMultipleFiles(f_evt:FileListEvent):void


                                              var refAddfiles:Array = f_evt.files;

                                              var dupArrList:Array= new Array();

                                              for (var i:int = 0; i < _arrUploadFiles.length; i++){

                                                        for (var j:int = 0; j < refAddfiles.length; j++){

                                                                  if (_arrUploadFiles[i].files.name == refAddFiles[j].files.name){


                                                                            refAddfiles.splice(j, 1);



                                                                  if (dupArrList.length >=1)


                                                                            Alert.show("The file(s): \n\n• " + dupArrList.join("\n• ") + "\n\n...are already on the upload list. Please change the filename(s) or pick a different file.", "File(s) already on list");




                                                                            for each(var tempF:File in f_evt.files){ 




                                                                                      pages.enabled = true;

                                                                                      tile.selectedIndex = 0;

                                                                                      listFiles.selectedIndex = 0;







      Thanks for any assistance