> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name: importFile(path: string, url: string, options: UploadOptions)

# Method package: wixMediaBackend

# Method menu location: wixMediaBackend --> MediaManager --> importFile

# Method Link: https://dev.wix.com/docs/velo/apis/wix-media-backend/media-manager/import-file.md

# Method Description:

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()`](https://dev.wix.com/docs/velo/apis/wix-media-backend/events/on-file-uploaded.md)
 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](https://dev.wix.com/docs/velo/api-reference/wix-media-backend/events/introduction.md). See [Importing and Uploading Files](https://dev.wix.com/docs/velo/api-reference/wix-media-backend/importing-and-uploading-files.md) to learn more.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## Import a file

```javascript
import { Permissions, webMethod } from 'wix-web-module';
import { mediaManager } from 'wix-media-backend';

export const importFile = webMethod(Permissions.Anyone, (url) => {
  return mediaManager.importFile(
    "/myImportFolder/subfolder",
    url,
    {
      "mediaOptions": {
        "mimeType": "image/jpeg",
        "mediaType": "image"
      },
      "metadataOptions": {
        "isPrivate": false,
        "isVisitorUpload": false,
        "context": {
          "someKey1": "someValue1",
          "someKey2": "someValue2"
        }
      }
    }
  );
});

/* Returns a promise that resolves to:
 *
 * {
 *   "fileUrl": "wix:image://v1/f6c0f9_tg439f4475a749e181dd14407fdbd37e~mv2.jpg/imported-pic.png#originWidth=319&originHeight=206",
 *   "hash": "Ew00kXbu4Zt33rzjcWa6Ng==",
 *   "sizeInBytes": 51085,
 *   "mimeType": "image/jpeg",
 *   "mediaType": "image",
 *   "isPrivate": false,
 *   "parentFolderId": "2bf470f5be194b319cdb2accc3278ff9",
 *   "originalFileName": "my-image.jpg",
 *   "sourceUrl": "https://somedomain.com/img/original-name.jpg",
 *   "opStatus": "IN-DOWNLOAD-QUEUE"
 * }
 */
```

---