Custom component find file in Action

Hello, I created a custom component to only allow the user to take a video, not from the gallerie and no photo.

I encounter a problem to import the file. I would like to update the current item and upload the file but when I configure the action I don’t see the component and the file.
Uploading: F3E50455-EC73-451F-BCBC-441527123389.jpeg…

Below my Src Index file and my Src Manifest file.

If someone can help me on this please !

Thank you so much by advance

Index :

import React, { useState } from ‘react’;

const FileUploader = ({ triggerUpload }) => {
const [file, setFile] = useState(null);

const handleFileChange = (event) => {
setFile(event.target.files[0]);
};

const handleUpload = () => {
if (file) {
// Convert the file to a data URL (base64)
const reader = new FileReader();
reader.onloadend = () => {
const base64data = reader.result;
triggerUpload({ file: base64data }); // Send the file data back to Adalo
};
reader.readAsDataURL(file);
} else {
alert(‘Please select a file first’);
}
};

return (




Validate and Upload


);
};

export default FileUploader;

Manifest :

{
“name”: “FileUploader”,
“displayName”: “File Uploader”,
“version”: “1.0.0”,
“description”: “A simple file uploader component that uploads when the user clicks the validate button.”,
“defaultWidth”: 320,
“defaultHeight”: 120,
“props”: ,
“methods”: ,
“actions”: [
{
“name”: “triggerUpload”,
“displayName”: “Trigger Upload”,
“description”: “Triggered when the user uploads a file by clicking the validate button.”,
“inputs”: [
{
“name”: “file”,
“type”: “file”,
“displayName”: “Uploaded File”
}
]
}
],
“styles”:
}

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.