Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to upload using DMI

    Hello,
    I am trying to upload a zip file using DMI. I am trying to pass DSRequest in the DMI call, so that I can retrive the file from the dsrequest.uploadedfile() call. However how do I get the instance of the current request of DSRequest.

    Pls help.

    thanks,
    ~S

    #2
    Declare it as a parameter of your DMI method and it is provided automatically.

    Comment


      #3
      I tried the following. But during the call, in firebug, it shows that DSRequest is undefined.

      Code:
      DMI.call("import", "import", "dbImport", 
                      {operation:"import", file_name: thisRef.getValue("db_import")},
                      DSRequest, null);
      What is the correct way.

      Comment


        #4
        Declare it as a parameter of your *server-side* method. You don't need to do anything client-side.

        Comment


          #5
          that is already done.

          Code:
          public String dbImport(HashMap<String, String> param, DSRequest dsRequest) {
          From what I understand, from the client-side it is passing null. However it is able to associate both the DSRequests with each other at the client/server end.
          The firebug hits the DSRequest, it shows the dsRequest is null.

          Comment


            #6
            Taking a step back, are you actually trying to upload a file via DMI, where the user has picked it via a FileItem/UploadItem (with a "Browse.." button)? If so, you can *only* do this by calling saveData() on the form where the user picked the file from local disk. You can't do it programatically because that would be a security violation since you could have the browser upload whatever you wanted from the user's disk.

            Once you switch to using saveData(), you will call your DMI by adding a <serverObject> declaration in your .ds.xml file (see samples). Then you'll have a DSRequest provided to you. Again, no need to pass it from the client.

            Comment


              #7
              Thanks much. I had tried the same earlier, but didnt seem to get the file at the getuploadedfile call. So was trying the DMI way. But now the getuploadedfile seem to work.
              Thanks once again.

              Comment

              Working...
              X