Collab with img and Skatepark
issue
Explaining my process
How
- Will take the code from James img uploading and try to put it into my code
Tried and Failed
- I realized that there a lot of extra things and stupid stuff that it makes it really hard to combined the too
How pt2
- Im just going to use the db separately but fetch both when using skateparks
- I think this will work cause the code for both already independently work, so why not
- I only need to make simple javascript additions to make it work
Highlighted Code
Javascript
- Learned about the .files
- The fetch was similar to normal fetches but had it inside of the other fetch once it finish okay
document.getElementById("image").files[0]
const imageUploadResponse = await fetch(imageUploadUrl, {
method: "POST",
body: formData
});
if (imageUploadResponse.ok) {
console.log("Image uploaded successfully");
} else {
console.error("Image upload failed");
}
HTML
- This is how you have the input where you click and it opens your files
<input type="file">