Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Uploading file using REST service

Avatar

Level 2

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#1614096

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?

1 Reply

Avatar

Level 10

FileReference cannot be directly uploaded to a Process which expects a com.idp.Document as its input paramter.

You will have to upload you file to server (Global Document Storage) first and then supply the uploaded document's URL to your process.

The following documentation is really useful to understand your scenario.

http://help.adobe.com/en_US/livecycle/9.0/programLC/help/000234.html#1549048

Nith