1 Reply Latest reply on Jun 27, 2011 3:05 AM by $Nith$

    Uploading file using REST service

    Adam_Chojnacki

      Hello,

       

      I have process (short-lived) "uploadFile" with REST endpoint with

      - Filedata - input variable (type : Document)

      - url - output variable (String)

       

       

      Process "uploadFile" uploads file to my external storage stytem and returns url to uploaded document.

       

      I want to invoke this process from UI - from workspace (using Felx).

      Basically I want to display file select dialog and invoke REST service - my "uploadFile" process.

       

      So I have written adobe flex form (and palced into another long-lived process) using

      FileReference object.

       

      When I invoke it (fire FileReference.browse()) login dialog appears (login to livecycle) and after logged in  it gives me an error message #2038: File I/O Error. URL:

       

      I know that this process is working well - I was able to invoke it using simple HTML form.

      Like that:

      http://help.adobe.com/en_US/livecycle/9.0/programLC/help/index.htm?content=000562.html#161 4096

       

       

      This is my flex code to upload file:

       

                  var request:URLRequest = new URLRequest(MY_URL);

       

                  try
                  {
                       fileRef.upload(request, "Filedata", true);
                  }
                  catch (error:Error)
                  {
                      Alert.show("Unable to upload file.");
                  }

       

      This is not file size limit issue (HTML form can upload files without problem), MY_URL - is well defined (not crossdomain issue - it is on the same server).

      Is it possible to invoke REST service using FileReference?

       

       

       

      Any ideas or sugesstions?