diff --git a/Frontend/src/components/FileInput.jsx b/Frontend/src/components/FileInput.jsx new file mode 100644 index 0000000..c5c090c --- /dev/null +++ b/Frontend/src/components/FileInput.jsx @@ -0,0 +1,38 @@ +import React from 'react' + +function FileInput() { + + const handleFileChange= () => { + const fileInput = document.getElementById("file_input"); + const file = fileInput.files[0]; + if (!file) { + alert("Please select a file!"); + return; + } + const formData = new FormData(); + formData.append("file", file); + + // Send to backend + fetch("http://your-backend-url.com/upload", { + method: "POST", + body: formData, + }) + .then((response) => response.json()) + .then((data) => console.log("File uploaded successfully:", data)) + .catch((error) => console.error("Upload failed:", error)); + } + + return ( +
+ + + + +
+ ) +} + +export default FileInput \ No newline at end of file