Last active
April 10, 2022 22:45
-
-
Save pipethedev/734771371b5de966d2e9ec80282d9005 to your computer and use it in GitHub Desktop.
Media upload with formdata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axis from 'axios'; | |
const formData = new FormData(); | |
formData.append("assigned_page", "Room page"); | |
formData.append("name", "Test Project"); | |
formData.append("media", this.state.selectedFile); | |
async function upload(){ | |
return await axios.post("<api_endpoint>", formData, { | |
headers: { | |
"Content-Type": "multipart/form-data", | |
}, | |
}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment