How to send a user generated image to the server using js, ajax or fetch ()?

  • 0
    Good day. There was such a problem: 1) The user draws a picture on canvas, the program converts it into a picture (png). It is necessary that this picture be sent to the server without reloading the page, so that later you can open it on the website page using a link.
    2) User records audio. It is sent to the server without reloading the page, and then it was also possible to refer to this audio file by the link.
    Please explain and provide the code.
    Thank you!!!
    JavaScript Anonymous, May 25, 2020

  • 1 Answers
  • 0
    I have already answered a similar question. Here in the answers there is a function for sending blobs to the server:

    How to get an audio file from the site?



    For images, learn more about how to get a Blob using Canvas:

    https://learn.javascript.com/blob#izobrazhenie-v-blob
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!