INTERMEDIATE: C297
To upload a file into the database
1. Get the files to be uploaded from the form.
2. Get the first file from image array
3. Create a FileReader object.
4. Convert the image to base64 format.
4. Listen to the load event
5. Get the DataURL from the readAsDataURL result
6. Create a JSON record with all the data
7. Call the fetch() with POST method
8. Convert the JSON object to a string and pass it to the body attribute.
9. Handle errors and display the data.
2. Saves the first file to be uploaded in the variable files.
1. Saves all the files to be uploaded.
3. Saves all the files to be uploaded.
4. None of the above
What does this code do?
What does the JSON.stringify() method do?
1. Converts string to JSON
2. Converts image to JSON
3. Converts JSON to string
Text
By int whitehatjrclass
Prince Raj