1 Reply Latest reply on Sep 1, 2013 8:02 AM by Sergey Khitrin

    Sending images via LrHttp.postMultipart


      So basically I am writing a plugin and want to be able to send images to my server. In Python, I want to be able to do this:


      import requests

      url =<URL removed>


      files = {'file': open('D:/asian dance/DSC_0003.NEF', 'rb')}

      payload = {'img_id': 17}

      r = requests.post(url, files=files, data=payload)



      So, as you can see, I want to be able to send a file and an img_id to the server using HTTP post. The above code works but I want to try this in lua (below), but for some reason this code is not working as intended. Can someone point me to any errors / offer suggestions?




      local function upload_pics_and_update()

                local LrHttp = import "LrHttp"

                local LrTasks = import "LrTasks"


                 content = {

                           {name = 'file', filePath = 'D:/asian dance/DSC_0003.NEF'},

                           {name = 'img_id', value = '17'},




                url = <URL REMOVED>

                import "LrTasks".startAsyncTask( function()

                          get_ID_result1, debug1 = LrHttp.postMultipart(url, content)

                end )






      Is my syntax wrong for the content? My server does not even get the postmultipart requests, as I am tracking those. Thanks for the help.