Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum Recipe: how to upload multiple documents in Javascript using drag&drop

  • Recipe: how to upload multiple documents in Javascript using drag&drop

    Posted by Christoph Schwerdtner on November 8, 2022 at 8:24 am

    Problem: when dragging multiple documents from operating system you get a pDragValue List with one line per document. If you use $clientcommand to read every file in a loop the corresponding call to $filereadcomplete is only executed once.


    1. in on evDrop use instance var iDragList to save pDragValue and call $readnext

    2. new method $readnext (client executed) reads the current file in iDragList using $clientcommand(“readfile”) and increments the current line

    3. $filereadcomplete adds the file to a iFileList and calls $readnext

    dropFilesHere Button or other element with dropmode kAcceptOperatingSystem

    On evDrop

    If pDragType=kDragOperatingSystem

    Calculate iDragList as pDragValue
    Do $cinst.$readnext()
    End If

    Andreas Pfeiffer replied 5 months, 4 weeks ago 2 Members · 2 Replies
  • 2 Replies
  • Christoph Schwerdtner

    November 8, 2022 at 8:35 am


    $readnext (client executed)

    If iDragList.$line<iDragList.$linecount
    Calculate iDragList.$line as iDragList.$line+1
    Do $cinst.$clientcommand("readfile",row(iDragList.c4,"iFileObject",1))
    Do iDragList.$clear()
    End If

    $filereadcomplete (client executed)

    Do iFileList.$add(pIdent,iFileObject,iDragList.c1)
    Do $cinst.$readnext()

  • Andreas Pfeiffer

    June 9, 2023 at 12:11 pm

    Hi Christoph,

    check out the new Omnis Studio 11 JS File upload / download sample in the HUB.



Log in to reply.