import React, { useState } from "react"; import { logout } from "../util/Util"; import '../css/Panel.css'; const Panel = () => { const [selectedFile, updateSelection] = useState(null); const [clipname, updateName] = useState(''); const submit = async () => { const formData = new FormData(); formData.set('file', selectedFile, selectedFile.name); formData.set('name', clipname); //console.log(selectedFile) for(const value of formData.values()) console.log('loop',value); const response = await fetch('/api/upload', { method: 'POST', body: formData, credentials: 'include' }); console.log(response); }; return (
updateSelection(event.target.files[0])} /> | |
updateName(event.target.value)} autoComplete='off' /> | |