# JetEngine

This tutorial helps you get the file upload from the JetEngine plugin into the FileBird folders via JetEngine Form.

1. Go to JetEngine -> Forms to create a form.
2. Navigate to Field Settings.&#x20;

* In the Type field, please choose **Media**
* Name **File\_upload** in the name field or any name that your users can recognize its purpose.
* You can choose who can see, and upload the files in the User Access setting.
* Input the maximum allowed files to upload.
* Choose which type of MIME you allow to upload into the form, and so on...

<figure><img src="https://3041978267-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyIWF9CNHLQhdztdjt8Uo%2Fuploads%2Fvt8yRdRtwCBCV8NqPiZw%2Fcreate%20jetengine%20form%20.jpg?alt=media&#x26;token=ea96dffa-b3d0-4e5f-8ddb-6c696d6c51e7" alt="create a upload file form in jetengine "><figcaption><p>Create a Form in JetEngine</p></figcaption></figure>

3. Use Browser Inspector to get the FileBird's folder ID, which will be used to add the files after the form submitted. <br>

<figure><img src="https://3041978267-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyIWF9CNHLQhdztdjt8Uo%2Fuploads%2FQozxG4HUwIAl0UV8oawA%2Fget%20id%20form.jpg?alt=media&#x26;token=d412e09e-56d5-45a2-94bd-22a484aa72d2" alt=""><figcaption><p>How to get the FileBird's folder ID</p></figcaption></figure>

4. Add the functionality to integrate FileBird with JetEngine Form. You might use WPCode or add it to the theme functions.php

```
use FileBird\Model\Folder as FolderModel;

add_action('jet-engine/forms/handler/after-send', function($data, $success ){
	$files = $data->form_data['file_upload'];

	if (is_array($files)) {
		foreach ($files as $file) {
			FolderModel::setFoldersForPosts($file['id'], 168);
		}
	} else {
		FolderModel::setFoldersForPosts($file['id'], 168);
	}

}, 10,2);
```

\
That's it. Now, you have all the uploaded files in the FileBird Media Folder successfully.

{% hint style="danger" %}
Note: In this function, we get the file upload from the field “file\_upload” in $data->form\_data\[‘file\_upload’], the “file\_upload” must be the same name with the field we created above, and the FileBird's folder ID is ‘168’.
{% endhint %}
