importFile( )


Imports a file to the Media Manager from a URL.

The importFile() function returns a Promise that resolves to information about the newly imported file.

Video and audio files that have been imported aren't immediately available to be used even after the Promise is resolved. Before they can be used, they must first undergo transcoding. The onFileUploaded() event is triggered when an imported file has been uploaded and before the transcoding is finished. As a result, some properties such as the fileUrl may not initially appear in the returns.

Note: Receiving a response does not indicate that the import is complete. To run code when the import finishes, implement the relevant event. See Importing and Uploading Files to learn more.

Method Declaration
Copy
Method Parameters
pathstringRequired

The path within the Media Manager where the file will be uploaded. If the path doesn't yet exist, the missing folders will be created, for example: /media/files.

If metadataOptions.isVisitorUpload is true (default), the visitor-uploads folder is the root of the file path, in this case, visitor-uploads/media/files/.


urlstringRequired

The file's external URL, where it was imported from.


optionsUploadOptionsRequired

Options to use when uploading a file

Returns
Return Type:Promise<FileInfo>
Was this helpful?
Yes
No