File uploads
How to upload files Notion with Notion Monkey
Last updated
How to upload files Notion with Notion Monkey
Last updated
Notion Monkey allows you to upload files using native form fields. This can be great for certain use cases when you need more than text from your form.
First, you need to enable file uploads for the forms that you want to accept files on. Do this by toggling File Upload to on.
In the form tag, you must add an enctype=multipart/form-data
attribute. Then add an <input type='file' name='My File'/>
tag to your form. There's a number of options you can add to this tag to customize it. For example, if you only want to accept PNG and JPEG images, we can add accept="image/png, image/jpeg"
. You can learn more about all the available options for the file input tag here.
When a user uploads a file using one of your form's file input fields, it behaves like any other Notion Monkey field, except the files are converted into download links:
File uploads are limited to 6MB. If you need to upload larger files you need to use the Notion Monkey Files.js library.
Simply, insert this JS code in the page with your form.
This code will automatically intercept submission events on any form with an api.notionmonkey.io
action, upload the files and then submit the form when the uploads are complete.
This code will also disable form submit buttons while uploads are processing to prevent double submit events.
Example form
If you want to track the progress and state of uploads you can listen to upload events emitted from the file.js library like so:
Events have the following json properties:
name: string. The name of the event. The event names are:
sheetmonkey-upload-start
sheetmonkey-upload-progress
sheetmonkey-upload-error
sheetmonkey-upload-complete
file: string. The name of the file being uploaded.
percent. number. The progress of the file upload. Only sent on sheetmonkey-upload-progress
events.
errorCode. number. The error code if the file upload filed. Only sent on sheetmonkey-upload-error
events.
If your form needs to upload larger files, it might be a good idea to show upload progress. If you're using the files.js library, you can add the following element anywhere into your HTML and Sheet Monkey will update the progress.
You can style this element however you'd like and you can place it anywhere on the page.
File Uploads requires an unlimited account.
Uploads are limited to 100MB.
Users may have issues with larger files on slower connections.
Please contact support with any issues you encounter.