# create\_temporarily\_download\_url()

## Create a temporarily download url

&#x20; <mark style="background-color:orange;">create\_temporarily\_download\_url()</mark> &#x20;

Create a temporarily download url for a file or folder.

{% tabs %}
{% tab title="OneDrive" %}

### **Parameters**

<table><thead><tr><th width="196">Name</th><th width="87">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>$id</code></td><td>string</td><td>ID of the entry</td></tr></tbody></table>

### **Return**

<table><thead><tr><th width="194">Name</th><th width="89">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>$url</code></td><td>string</td><td>A temporarily download link for the requested file or folder. The link is valid for ~ 15 minutes.</td></tr></tbody></table>

### **Usage**

```php
WPCP_ONEDRIVE_API::set_account_by_id('8c9bacda0-d8d8-4b22-b634-7b5281687575');
WPCP_ONEDRIVE_API::set_drive_by_id('b!DlaHWskCed_MIid3KpJH5Lbatf9HsdXBAZH5YcvPAbMhJUKzTJyzgvXZYpBS');

// Create temporarily download url
$temporarily_url = WPCP_ONEDRIVE_API::create_temporarily_download_url('01EXLSWHRCD7RDL3HX65BK5X3ULXLWSICN');

// Redirect user to download url
header('Location: '.$temporarily_url);
exit;
```

{% endtab %}

{% tab title="Google Drive" %}
{% hint style="info" %}

#### **Not supported. Use** [**`download()`**](https://wpcloudplugins.gitbook.io/docs/developers/api/download) **instead**

{% endhint %}
{% endtab %}

{% tab title="Dropbox" %}

### **Parameters**

<table><thead><tr><th width="185">Name</th><th width="168">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>$id</code></td><td>string</td><td>ID of the entry</td></tr></tbody></table>

### **Return**

<table><thead><tr><th width="184">Name</th><th width="167">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>$link_data</code></td><td><strong>TemporyLink</strong></td><td>A Dropbox TemporyLink object</td></tr></tbody></table>

### **Usage**

```php
WPCP_DROPBOX_API::set_account_by_id('dbid:AADSy6JxzbgqCs4A43CAAAfO9xvZwpcsLU');

// Create temporarily download url
$link_data = WPCP_DROPBOX_API::create_temporarily_download_url('id:4tUAwPCAdf0b0AAAAA_iw');

// Get url
$temporarily_url = $link_data->getLink();

// Redirect user to download url
header('Location: '.$temporarily_url);
exit;
```

{% endtab %}

{% tab title="Box" %}

### **Parameters**

<table><thead><tr><th width="212">Name</th><th width="93">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>$id</code></td><td>string</td><td>ID of the entry</td></tr></tbody></table>

### **Return**

<table><thead><tr><th width="210">Name</th><th width="96">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>$url</code></td><td>string</td><td>A temporarily download link for the requested file or folder. The link is valid for ~ 15 minutes.</td></tr></tbody></table>

### **Usage**

```php
WPCP_BOX_API::set_account_by_id('29232154182');

// Create temporarily download url
$temporarily_url = WPCP_BOX_API::create_temporarily_download_url('511426724354');

// Redirect user to download url
header('Location: '.$temporarily_url);
exit;
```

{% endtab %}
{% endtabs %}
