How to store a file in MySQL through Sequelise in next.js>

Viewed 21

Uploading the file from a form and reading it as a dataURL

  <Input name="supportingDocuments" accept=".txt, .pdf, .jpg, .jpeg, .docx" id="contained-button-file" multiple type="file" 
        onChange={(e)=>{
              const fileReader = new FileReader();
              fileReader.onload = () => {
                     if (fileReader.readyState === 2) {
                             formik.setFieldValue('supportingDocuments', fileReader.result);
                             setState(fileReader.result);
                       }
             };
             fileReader.readAsDataURL(e.target.files[0]);

 }}
/>

How can I store it in MySQL and access it later in my application?

0 Answers
Related