> 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
# GetMediaUploadURL
# Package: forms
# Namespace: FormSubmissionService
# Method link: https://dev.wix.com/docs/api-reference/crm/forms/form-submissions/get-media-upload-url.md
## Permission Scopes:
Manage Submissions: SCOPE.DC-FORMS.MANAGE-SUBMISSIONS
## Introduction
> **Note:** The Form Submission API only works with the Wix Forms app. Call [GetAppInstance](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/get-app-instance.md) to confirm that the app named `wix_forms` is installed on the site.
Retrieves a URL, generated by [Media Manager](https://dev.wix.com/api/rest/media/media-manager/files/generate-file-upload-url), to allow clients to upload a file to a form for submission.
---
## REST API
### Schema
```
Method: getMediaUploadUrl
Description: > **Note:** The Form Submission API only works with the Wix Forms app. Call [GetAppInstance](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/get-app-instance.md) to confirm that the app named `wix_forms` is installed on the site.
Retrieves a URL, generated by [Media Manager](https://dev.wix.com/api/rest/media/media-manager/files/generate-file-upload-url), to allow clients to upload a file to a form for submission.
URL: https://www.wixapis.com/v4/submissions/media-upload-url
Method: POST
# Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
Required parameters: formId, mimeType, filename
Method parameters:
param name: filename | type: filename | description: Name of file to upload. | required: true
param name: formId | type: formId | description: Form GUID. | required: true
param name: mimeType | type: mimeType | description: [Mime type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#) of file to upload. For example, `'image/png'` | required: true
Return type: GetMediaUploadURLResponse
- name: uploadUrl | type: string | description: Url to upload file.
```
### Examples
### GetMediaUploadURL
```curl
~~~cURL
curl -X POST \
'http://www.wixapis.com/form-submission/v4/submissions/media-upload-url' \
-H 'Content-Type: application/json' \
-H 'Authorization: ' \
-d '{
"form_id": "e62e3011-55cf-4de3-a497-e097b52d86b8",
"filename": "cats.mp4",
"mimeType": "video/mp4"
}'
~~~
```
---
## JavaScript SDK
### Schema
```
Method: wixClientAdmin.forms.FormSubmissionService.getMediaUploadUrl(formId, filename, mimeType)
Description: > **Note:** The Form Submission API only works with the Wix Forms app. Call [GetAppInstance](https://dev.wix.com/docs/rest/api-reference/app-management/apps/app-instance/get-app-instance.md) to confirm that the app named `wix_forms` is installed on the site.
Retrieves a URL, generated by [Media Manager](https://dev.wix.com/api/rest/media/media-manager/files/generate-file-upload-url), to allow clients to upload a file to a form for submission.
# Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
Required parameters: formId, mimeType, filename
Method parameters:
param name: filename | type: string | description: Name of file to upload. | required: true
param name: formId | type: string | description: Form GUID. | required: true
param name: mimeType | type: string | description: [Mime type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#) of file to upload. For example, `'image/png'` | required: true
Return type: PROMISE
- name: uploadUrl | type: string | description: Url to upload file.
```
### Examples
### Get media upload URL
```javascript
import { submissions } from '@wix/forms';
/*
Sample formID value: "21bcb6c7-02b3-4ed1-b6db-7856094fac03"
Sample filename value: "cats.mp4"
Sample mimeType value: "video/mp4"
*/
export async function myGetMediaUploadUrlFunction(formId, filename, mimeType) {
try {
const uploadUrl = await submissions.getMediaUploadUrl(formId, filename, mimeType);
console.log('Success! Upload URL:', uploadUrl);
return uploadUrl;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
{
"uploadUrl": "https://upload.wixmp.com/upload/eyJhbGciOiJfdddcCI6IkpXVCJ9.eyJqdGkiOiIqweFkM2NiMi0zYzQ4LTRjNDQtODBkNi0yYmEwMTUwZDM0OTEiLCJhdWQiOiJ1cm46c2VydmljZTp1cGx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2MVJmSTg3WUY3YllKRGdlNWZqc21ZMk9WSEUiLCJhY2wiOiJwdWJsaWMiLCJtaW1lVHlwZSI6ImltYWdlL3BuZyJ9.z0G6bPu_K1qdoj9EK-6Lo_ZEpd2jTihSp6LEPBVqiXw"
}
*/
```
### getMediaUploadUrl (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).
```javascript
import { createClient } from '@wix/sdk';
import { submissions } from '@wix/forms';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed
const myWixClient = createClient ({
modules: { submissions },
// Include the auth strategy and host as relevant
});
async function getMediaUploadUrl(formId,filename,mimeType) {
const response = await myWixClient.submissions.getMediaUploadUrl(formId,filename,mimeType);
};
```
---