com.adobe.livecycle.content

# File - AS3 ADEP Content

Package | com.adobe.livecycle.content
Class | public class File
Inheritance | File EventDispatcher Object
Implements | IManaged

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

File enables efficient transportation of binary content to and from the Experiece Server. It never stores binary content inside it but has all metadata to store and retrieve binary content to/from server. It has capability to upload file from filesystem or byte array to server. It is Data Services managed class so that any content change is notified. It dispatches FileEvent.FILE_CONTENT_CHANGE_EVENT when content is modified on the Experience Server.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | baseURL : String [static] The baseURL of Experience Server. | File
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | contentStreamPath : String TempPath when content is temporarily uploaded. | File
|  | contextRoot : String [static] The context root of launchpad application. | File
|  | created : Date Date when file is created. | File
|  | createdBy : String The user ID of user who created file. | File
|  | extendedPropertyMap : Object Additional key-value attributes whichare persisted along with file. | File
|  | fileName : String The name of the file. | File
|  | id : String The identifier of the file node. | File
|  | lastModified : Date The last date the content was modified. | File
|  | lastModifiedBy : String The user ID of user who last modified the file. | File
|  | mimeType : String The MIME type of the content. | File
|  | securityManager : SecurityManager [static] The User Manager (UM) SecurityManager instance. | File
|  | tempPath : String The temporary path to store the file. | File

Protected Properties

| Property | Defined By
--- | --- | ---
|  | boundary : String [read-only] Boundary of multipart request used in multipart binary upload of content. | File

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | File() constructor of File. | File
|  | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. | EventDispatcher
|  | deleteFile():void Deletes the JCR node specified by this instance. | File
|  | dispatchEvent(event:Event):Boolean Dispatches an event into the event flow. | EventDispatcher
|  | downloadContentToByteArray():void download content of jcr node into ByteArray. | File
|  | downloadContentToFileSystem(defaultFileName:String = null):void Downloads content of the JCR node to filesytem. | File
|  | fillMetaData():void Fill the current instance with metadata of jcr node. | File
|  | hasEventListener(type:String):Boolean Checks whether the EventDispatcher object has any listeners registered for a specific type of event. | EventDispatcher
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void Removes a listener from the EventDispatcher object. | EventDispatcher
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | updateFromByteArray(fileData:ByteArray, mimeTypeStr:String = null):void Updates content of jcr node specified by this instance from file on ByteArray. | File
|  | updateFromFileReference(typeFilter:Array = null):void Updates content of jcr node specified by this instance from file on filesystem. | File
|  | uploadToPathFromByteArray(parentPath:String, fileData:ByteArray, mimeType:String, fileNameArg:String):void Uploads file to location specified by parenPath on the Experience Server from a ByteArray value. | File
|  | uploadToPathFromFileReference(parentPath:String, typeFilter:Array = null):void Uploads file on filesystem at path specified by parentPath on the Experience Server. | File
|  | uploadToTempFromByteArray(fileData:ByteArray, mimeType:String, fileNameArg:String = null):void Uploads file to temporary location to the Experience Server from a ByteArray value. | File
|  | uploadToTempFromFileReference(typeFilter:Array = null):void Uploads file on filesystem to temporary location on the Experience Server.It uses FileReference to upload file to the Experience Server. | File
|  | valueOf():Object Returns the primitive value of the specified object. | Object
|  | willTrigger(type:String):Boolean Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. | EventDispatcher

Protected Methods

| Method | Defined By
--- | --- | ---
|  | appendSecurityTicket(url:String, ticket:com.adobe.livecycle.ria.security.api:ITicket):String Appends User Manager (UM) ticket to the URL. | File

Events
Click for more information on events
Hide Inherited Events
Show Inherited Events

| Event | Summary | Defined By
--- | --- | --- | ---
|  | activate | [broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher
|  | deactivate | [broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher

Public Constants

| Constant | Defined By
--- | --- | ---
|  | NT_FILE : String = "nt:file" [static] constant representing nt:file | File
|  | TEMP_FOLDER_NAME : String = "/tmp/uploadFilesTempDir" [static] The temporary path of folder where temp files will be uploaded. | File

Property Detail

### baseURL

property

`public static var baseURL:String`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

The baseURL of Experience Server. Set it once and File APIs use it to upload and download content from it.

### boundary

property

`boundary:String` [read-only]

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

Boundary of multipart request used in multipart binary upload of content.

Implementation
`protected function get boundary():String`

### contentStreamPath

property

`contentStreamPath:String`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

TempPath when content is temporarily uploaded. It is only populated when content is uploaded using uploadToTempFromFileReference,uploadToTempFromByteArray. path of the content.

This property can be used as the source for data binding. When this property is modified, it dispatches the `propertyChange` event.

Implementation
`public function get contentStreamPath():String`
`public function set contentStreamPath(value:String):void`

### contextRoot

property

`public static var contextRoot:String`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

The context root of launchpad application.

### created

property

`created:Date`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

Date when file is created.

This property can be used as the source for data binding. When this property is modified, it dispatches the `propertyChange` event.

Implementation
`public function get created():Date`
`public function set created(value:Date):void`

### createdBy

property

`createdBy:String`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

The user ID of user who created file.

This property can be used as the source for data binding. When this property is modified, it dispatches the `propertyChange` event.

Implementation
`public function get createdBy():String`
`public function set createdBy(value:String):void`

### extendedPropertyMap

property

`extendedPropertyMap:Object`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

Additional key-value attributes whichare persisted along with file. This value is applicable when the file is created using the RepositoryService or LiveCycleContentAssembler service.

This property can be used as the source for data binding. When this property is modified, it dispatches the `propertyChange` event.

Implementation
`public function get extendedPropertyMap():Object`
`public function set extendedPropertyMap(value:Object):void`

### fileName

property

`fileName:String`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

The name of the file.

This property can be used as the source for data binding. When this property is modified, it dispatches the `propertyChange` event.

Implementation
`public function get fileName():String`
`public function set fileName(value:String):void`

### id

property

`id:String`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

The identifier of the file node.

This property can be used as the source for data binding. When this property is modified, it dispatches the `propertyChange` event.

Implementation
`public function get id():String`
`public function set id(value:String):void`

### lastModified

property

`lastModified:Date`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

The last date the content was modified.

This property can be used as the source for data binding. When this property is modified, it dispatches the `propertyChange` event.

Implementation
`public function get lastModified():Date`
`public function set lastModified(value:Date):void`

### lastModifiedBy

property

`lastModifiedBy:String`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

The user ID of user who last modified the file.

This property can be used as the source for data binding. When this property is modified, it dispatches the `propertyChange` event.

Implementation
`public function get lastModifiedBy():String`
`public function set lastModifiedBy(value:String):void`

### mimeType

property

`mimeType:String`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

The MIME type of the content.

This property can be used as the source for data binding. When this property is modified, it dispatches the `propertyChange` event.

Implementation
`public function get mimeType():String`
`public function set mimeType(value:String):void`

### securityManager

property

`public static var securityManager:SecurityManager`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

The User Manager (UM) SecurityManager instance. Set it once and File APIs use it to retrieve ticket and credentials.

### tempPath

property

`tempPath:String`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

The temporary path to store the file.

This property can be used as the source for data binding. When this property is modified, it dispatches the `propertyChange` event.

Implementation
`public function get tempPath():String`
`public function set tempPath(value:String):void`
Constructor Detail

### File

()
Constructor

`public function File()`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

constructor of File.

Method Detail

### appendSecurityTicket

()
method

`protected function appendSecurityTicket(url:String, ticket:com.adobe.livecycle.ria.security.api:ITicket):String`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

Appends User Manager (UM) ticket to the URL.

Parameters

| `url:String` — url string
| `ticket:com.adobe.livecycle.ria.security.api:ITicket` — UM ticket

Returns

| `String` — ticket appended url

### deleteFile

()
method

`public function deleteFile():void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

Deletes the JCR node specified by this instance. It dispatches FileEvent.FILE_DELETED_EVENT on completion of file upload.

Related API Elements

com.adobe.livecycle.content.FileEvent.FILE_DELETED_EVENT
flash.events.Event.CANCEL
flash.events.HTTPStatusEvent.HTTP_STATUS
flash.events.IOErrorEvent.IO_ERROR
flash.events.Event.OPEN
flash.events.SecurityErrorEvent.SECURITY_ERROR
flash.events.ProgressEvent.PROGRESS

### downloadContentToByteArray

()
method

`public function downloadContentToByteArray():void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

download content of jcr node into ByteArray. It dispatches FileEvent.FILE_DOWNLOAD_COMPLETED_EVENT on completion of file download.

Related API Elements

com.adobe.livecycle.content.FileEvent.FILE_DOWNLOAD_COMPLETED_EVENT
flash.events.HTTPStatusEvent.HTTP_STATUS
flash.events.IOErrorEvent.IO_ERROR
flash.events.Event.OPEN
flash.events.SecurityErrorEvent.SECURITY_ERROR
flash.events.ProgressEvent.PROGRESS

### downloadContentToFileSystem

()
method

`public function downloadContentToFileSystem(defaultFileName:String = null):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

Downloads content of the JCR node to filesytem. It uses FileReference to download content. It dispatches FileEvent.FILE_DOWNLOAD_COMPLETED_EVENT on completion of file download.

Parameters

| `defaultFileName:String` (default = `null`)`` — default file name by which file is saved on file system. It appears in save dialog box.

Related API Elements

com.adobe.livecycle.content.FileEvent.FILE_DOWNLOAD_COMPLETED_EVENT
flash.events.Event.CANCEL
flash.events.HTTPStatusEvent.HTTP_STATUS
flash.events.IOErrorEvent.IO_ERROR
flash.events.Event.OPEN
flash.events.SecurityErrorEvent.SECURITY_ERROR

### fillMetaData

()
method

`public function fillMetaData():void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

Fill the current instance with metadata of jcr node. It makes a call to the Experience Server and retrieves all properties and fills in current instance. It dispatches FileEvent.FILE_METADATA_FILLED_EVENT when metadata is populated in instance.

Related API Elements

com.adobe.livecycle.content.FileEvent.FILE_METADATA_FILLED_EVENT
flash.events.Event.CANCEL
flash.events.HTTPStatusEvent.HTTP_STATUS
flash.events.IOErrorEvent.IO_ERROR
flash.events.Event.OPEN
flash.events.SecurityErrorEvent.SECURITY_ERROR
flash.events.ProgressEvent.PROGRESS

### updateFromByteArray

()
method

`public function updateFromByteArray(fileData:ByteArray, mimeTypeStr:String = null):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

Updates content of jcr node specified by this instance from file on ByteArray. It uses FileReference to upload file from filesystem. It doesn't update content of temporary file i.e. File object created from uploadToTempFromFileReference and uploadToTempFromByteArray. It doesn't update content on File instance which is retrieved from repository. To update such instance upload content via uploadToTempFromFileReference or uploadToTempFromByteArray API and update it via LiveCycleContentAssembler or RepositoryService. It dispatches FileEvent.FILE_UPLOAD_COMPLETED_EVENT on completion of file upload.

Parameters

| `fileData:ByteArray` — the data which will be updated
| `mimeTypeStr:String` (default = `null`)`` — the new mimeType of the data.

Related API Elements

com.adobe.livecycle.content.FileEvent.FILE_UPLOAD_COMPLETED_EVENT
flash.events.HTTPStatusEvent.HTTP_STATUS
flash.events.IOErrorEvent.IO_ERROR
flash.events.Event.OPEN
flash.events.SecurityErrorEvent.SECURITY_ERROR
flash.events.ProgressEvent.PROGRESS

### updateFromFileReference

()
method

`public function updateFromFileReference(typeFilter:Array = null):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

Updates content of jcr node specified by this instance from file on filesystem. It uses FileReference to upload file from filesystem. It doesn't update content of temporary file i.e. File object created from uploadToTempFromFileReference and uploadToTempFromByteArray. It dispatches FileEvent.FILE_UPLOAD_COMPLETED_EVENT on completion of file upload. It doesn't update content on File instance which is retrieved from repository. To update such instance upload content via uploadToTempFromFileReference or uploadToTempFromByteArray API and update it using the LiveCycleContentAssembler or RepositoryService service.

Parameters

| `typeFilter:Array` (default = `null`)`` — file type filter to filter files in File select dialog.

Related API Elements

com.adobe.livecycle.content.FileEvent.FILE_UPLOAD_COMPLETED_EVENT
flash.events.Event.CANCEL
flash.events.HTTPStatusEvent.HTTP_STATUS
flash.events.IOErrorEvent.IO_ERROR
flash.events.Event.OPEN
flash.events.SecurityErrorEvent.SECURITY_ERROR
flash.events.ProgressEvent.PROGRESS

### uploadToPathFromByteArray

()
method

`public function uploadToPathFromByteArray(parentPath:String, fileData:ByteArray, mimeType:String, fileNameArg:String):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

Uploads file to location specified by parenPath on the Experience Server from a ByteArray value. It creates nt:file node at temporary location. The current instance will be consumed by lc-content RepositoryService to move content from temp location to actual location. It dispatches FileEvent.FILE_UPLOAD_COMPLETED_EVENT on completion of file upload.

Parameters

| `parentPath:String` — path upto parent folder location.
| `fileData:ByteArray` — content of file.
| `mimeType:String` — mimeType of file.
| `fileNameArg:String` — name of the file node that will be created on server.

Related API Elements

com.adobe.livecycle.content.FileEvent.FILE_UPLOAD_COMPLETED_EVENT
flash.events.HTTPStatusEvent.HTTP_STATUS
flash.events.IOErrorEvent.IO_ERROR
flash.events.Event.OPEN
flash.events.SecurityErrorEvent.SECURITY_ERROR
flash.events.ProgressEvent.PROGRESS

### uploadToPathFromFileReference

()
method

`public function uploadToPathFromFileReference(parentPath:String, typeFilter:Array = null):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

Uploads file on filesystem at path specified by parentPath on the Experience Server. It uses FileReference to upload file to the Experience Server. It dispatches FileEvent.FILE_UPLOAD_COMPLETED_EVENT event when the file upload completes.

Parameters

| `parentPath:String` — path upto parent folder location.
| `typeFilter:Array` (default = `null`)`` — file type filter to filter files in File select dialog.

Related API Elements

com.adobe.livecycle.content.FileEvent.FILE_UPLOAD_COMPLETED_EVENT
flash.events.Event.CANCEL
flash.events.HTTPStatusEvent.HTTP_STATUS
flash.events.IOErrorEvent.IO_ERROR
flash.events.Event.OPEN
flash.events.SecurityErrorEvent.SECURITY_ERROR
flash.events.ProgressEvent.PROGRESS

### uploadToTempFromByteArray

()
method

`public function uploadToTempFromByteArray(fileData:ByteArray, mimeType:String, fileNameArg:String = null):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

Uploads file to temporary location to the Experience Server from a ByteArray value. It creates nt:file node at temporary location. The current instance will be consumed by lc-content RepositoryService to move content from temp location to actual location. It dispatches FileEvent.FILE_UPLOAD_COMPLETED_EVENT on completion of file upload.

Parameters

| `fileData:ByteArray` — content of file.
| `mimeType:String` — mimeType of file.
| `fileNameArg:String` (default = `null`)`` — name of the file node that will be created on server.

Related API Elements

com.adobe.livecycle.content.FileEvent.FILE_UPLOAD_COMPLETED_EVENT
flash.events.Event.CANCEL
flash.events.HTTPStatusEvent.HTTP_STATUS
flash.events.IOErrorEvent.IO_ERROR
flash.events.Event.OPEN
flash.events.SecurityErrorEvent.SECURITY_ERROR

### uploadToTempFromFileReference

()
method

`public function uploadToTempFromFileReference(typeFilter:Array = null):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

Uploads file on filesystem to temporary location on the Experience Server.It uses FileReference to upload file to the Experience Server. It creates nt:file node at temporary location. The current instance will be consumed by lc-content RepositoryService to move content from temp location to actual location. It dispatches FileEvent.FILE_UPLOAD_COMPLETED_EVENT on completion of file upload.

Parameters

| `typeFilter:Array` (default = `null`)`` — file type filter to filter files in File select dialog.

Related API Elements

com.adobe.livecycle.content.FileEvent.FILE_UPLOAD_COMPLETED_EVENT
flash.events.Event.CANCEL
flash.events.HTTPStatusEvent.HTTP_STATUS
flash.events.IOErrorEvent.IO_ERROR
flash.events.Event.OPEN
flash.events.SecurityErrorEvent.SECURITY_ERROR
flash.events.ProgressEvent.PROGRESS
Constant Detail

### NT_FILE

Constant

`public static const NT_FILE:String = "nt:file"`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

constant representing nt:file

### TEMP_FOLDER_NAME

Constant

`public static const TEMP_FOLDER_NAME:String = "/tmp/uploadFilesTempDir"`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Experience Services - Content 10

Runtime Versions: | AIR 2.6, Flash Player 10.2

The temporary path of folder where temp files will be uploaded. The default path is /content/uploadFilesTempDir.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00