File ID

A file's ID is its unique identifier. It is a read-only property.

It's good practice to save all of a file's properties in your code when you retrieve them.

A file's ID must be retrieved programmatically. It can't be retrieved through the editor or media manager. There are several functions that include fileId in their response:

File ID as a parameter

There are several functions that accept a file ID, or an array of file IDs, as a parameter. The parameter is called fileId or fileIds.

In addition to the file ID, these parameters accept the file's Wix media URL. For example, wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032.

This is useful when using other Wix APIs, such as wix-data or wix-data.v2, that return a media file's Wix media URL, not its ID. For example, if you are retrieving a CMS collection that contains an image field, the image files' IDs aren't returned but their Wix media URLs are returned.

You can display media files in elements on your site's page. You can grab the details of media files displayed in elements on your site by using $w(). This returns an object with a src property that points to its Wix media URL. For example, $w('#myImage).src === wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032.

Folder ID

A folder's ID is its unique identifier. It is a read-only property.

A folder's ID must be retrieved programmatically. It can't be retrieved through the editor or media manager. There are several functions that include folderId in their response:

Parent Folder ID

A file's or folder's parent folder ID tells us in which folder it is located. Usually, a parent folder ID will be a string of random letters and number, for example '7984b3c5454e4371aqbd4f4eedde96bc'. However, there are 3 parent folders whose IDs look different (these are their IDs):

  • 'media-root' - this folder contains all files and folders in the root level of the Site Files tab in the media manager.
  • 'visitor-uploads' - this folder contains all files and folders in the root level of the Visitor Uploads tab in the media manager.
  • 'trash-root' - this folder contains all files and folders in the root level of the Trash tab in the media manager.
Did this help?