When clicking on a file upload field, the app will give you the option to upload an image 📸. If you want to add the option to use the camera directly for image uploads, follow these steps:
Steps to enable the camera for file uploads:
- Go to Advanced Settings ⚙️ in your app’s configuration panel.
- Enable the camera by selecting “Yes” to allow access to the device’s camera 📷. This will let users upload images by capturing them directly from the camera.
- Go to the Integration Module 🔧.
- In the integration settings, enable Custom CSS & JS by toggling this option on.
- Then, navigate to the Custom JavaScript section ✍️.
- Paste the script code provided below into the custom JavaScript field. This code will allow the camera to be accessed from the file upload field.
- After pasting the code, make sure to save your changes 💾 by scrolling to the bottom and clicking the “Save” button.
- Finally, rebuild the app 🛠️ to apply the new settings. Once rebuilt, users will be able to choose between uploading an image from their gallery or using their camera directly when uploading files.
If you need further assistance or run into any issues, our support team is always available to help you ☎️💬.
The script:
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { const constraints = { video: true }; navigator.mediaDevices.getUserMedia(constraints) .then(function (stream) {}) .catch(function (error) {}); }