> 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`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt ## Resource: wix-media-backend ## Article: Importing and Uploading Files ## Article Link: https://dev.wix.com/docs/velo/apis/wix-media-backend/importing-and-uploading-files.md ## Article Content: # Importing and Uploading Files When you [import](https://dev.wix.com/docs/velo/api-reference/wix-media-backend/media-manager/import-file.md) or [upload](https://dev.wix.com/docs/velo/api-reference/wix-media-backend/media-manager/upload.md) a file, it's not immediately available, meaning you can't manage or use the file straight away. Files can take time to import or upload and be processed. This is true even though the function used to import or upload a file returns a successful response. To run code when a file finishes processing successfully, use the [`onFileUploaded()`](events/on-file-uploaded) event. For audio or video files, use [`onAudioTranscoded()`](https://dev.wix.com/docs/velo/api-reference/wix-media-backend/events/on-audio-transcoded.md) or [`onVideoTranscoded()`](https://dev.wix.com/docs/velo/api-reference/wix-media-backend/events/on-video-transcoded.md). ## Using `context` The [`import()`](https://dev.wix.com/docs/velo/api-reference/wix-media-backend/media-manager/import-file.md), [`upload()`](https://dev.wix.com/docs/velo/api-reference/wix-media-backend/media-manager/upload.md), and [`getUploadUrl()`](https://dev.wix.com/docs/velo/api-reference/wix-media-backend/media-manager/get-upload-url.md) functions have a parameter called `context`. Arguments passed to this parameter are included only in the `wix-media-backend` event bodies. Use `context` to pass information to the events that isn't contained in the file descriptor object. ### `context` use case Here is a sample flow to show how you could use `context` effectively. There is a form on a site that sends site visitors a confirmation email with the details they submitted in the form. One of the form fields is an image URL. In the email, we want to send a Wix download URL for the image, not the original image URL. This means we can only send the email when the image file is ready to download. To implement this, we use the following flow: 1. When the user submits the form, send the form information to a [data collection](https://dev.wix.com/docs/velo/api-reference/wix-data/introduction.md), getting back the form data's `_id`. 1. Use [`import()`](https://dev.wix.com/docs/velo/api-reference/wix-media-backend/media-manager/import-file.md) to upload the image to the Media Manager. Include the `context` parameter as follows: ```json { "context": { "origin": "formBuilder", "externalIds": ["_id"] } } ``` 1. Add the [`onFileUploaded()`](https://dev.wix.com/docs/velo/api-reference/wix-media-backend/events/on-file-uploaded.md) event in your **events.js** file, and implement the following steps to handle the event: 1. Check that the value for `context.origin` is `formBuilder`. We don't want to run this code if media was added from a different source. 1. Use the `_id` to [retrieve the form details](https://dev.wix.com/docs/velo/api-reference/wix-data/get.md) from the CMS. 1. [Get a download URL](https://dev.wix.com/docs/velo/api-reference/wix-media-backend/media-manager/get-download-url.md) for the image. 1. Send the confirmation email with the form details and the download URL.