|
Event flow of the ColdFusion service
Use the ActionScript flash.net.FileReference APIs
and the Util.UPLOAD_URL variable to upload an Image,
PDF, or mail attachment to the server on which the action has to
be performed. The upload URL to supply to the flash.net.FileReference APIs
can be constructed as follows in the ActionScript part of the application:
uploadURL.url = "http://"+conf.cfServer+":"+conf.cfPort+"/" +conf.contextRoot+"/"+Util.UPLOAD_URL;
Here,
specify "conf.cfServer", "conf.cfPort" and "conf.ContextRoot" in
the <cf:Config> tag. Specify "conf.ContextRoot" only if ColdFusion
is deployed as a J2EE application.
Note: The ActionScript FileUpload
functionality is out of the scope for this feature hence it is not
explained in detail, but an example of the usage is provided in
code in MAIL class section. For further information on FileUpload
functionality see the ActionScript documentation.
Once the file is uploaded, the server returns an XML response
containing URL of the uploaded file. Use the Util class function extractURLFromUploadResponse() to
extract the URL from the XML
Use the file URL in the source attribute of the service tags.
When the required service tag attributes are set, run the
service action by calling the following method:
serviceObject.execute()
If the action succeeds, the server returns the result. If
there is an exception, it returns the fault. Handle the ResultEvent and FaultEvent objects
in the service-specific result handler and fault handler that you
specify in the service tag, or in global handlers that you specify
in the <cf:config>. The ResultEvent object contains the URL
of the File on which the operations have been performed. Users can
save this file by downloading it on their machine or rendering it
in the application. The FaultEvent object contains the exception details
that occurred on the server while performing the operation.
|