A
A
Anton052020-10-12 22:54:10
PHP
Anton05, 2020-10-12 22:54:10

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

Good afternoon. There was such problem: 1) The user draws a picture in canvas, the program will transform it into a picture (png). It is necessary that this picture is sent to the server without reloading the page, so that later it can be opened on the site 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 access this audio file via a link.
Please explain and provide code.
Thanks!!!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nadim Zakirov, 2020-10-12
@zkrvndm

I 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?
If it's about images, then additionally learn how to get a Blob using Canvas:
https://learn.javascript.ru/blob#izobrazhenie-v-blob

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question