I create a website in which each user is assigned a photo.

This is done as follows. A person visits the site and is registered. The site has an area where you can take snapshots from a webcam, for this you can use a canvas object with src equal to the base64-code of the photo. By pressing the button, php transfers this src (of course, parsed) to the table.

And the problem is that when I try to decode and then open the image, I get an error that the file is damaged or too large. I created a text entry field and before sending the base64 code I write there. There is no problem when decoding base64 code from the text field. Also noticed that the length of base64 codes in the test field and in the table are different. In the table I use the LongText or MediumText , since the image is large (I tried it with small ones, the result is the same), the encoding is ascii What could be wrong?

  • and without writing to the database, the resulting base64_decode string is obtained immediately? - Dmitry V.
  • It is necessary to look at the code that you write to the database. I suspect that you are not screening base64. - Dmitry V.
  • Although it seems not necessary to screen ... In general, we are waiting for the code. - Dmitry V.
  • @DmitryV. Understood why an error occurs. In the text line there are "+" signs, and in the MySQL table, "+" is replaced with a space (""). How to avoid such a situation? - Daniil Gurin

1 answer 1

The question is closed, I process the line with spaces in php, replacing spaces with "+" signs

  • The response format is strange, but it is quite a normal answer. - Dmitriy Simushev