Skip to content

Post file using axios? #1269

Discussion options

You must be logged in to vote

This ended up being the solution.

    const onDrop = useCallback((acceptedFiles) => {
      acceptedFiles.forEach((file) => {
        const reader = new FileReader();

        reader.onabort = () => console.log("file reading was aborted");
        reader.onerror = () => console.log("file reading has failed");
        reader.onload = () => {
          console.log("File loaded!");
          Axios.post("http://127.0.0.1:8000/api/repair-upload/", file);
        };
        reader.readAsArrayBuffer(file);
      });
    }, []);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by caynebrister1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant