(1) The pictures are stored in the database
Use the el-upload component to convert the picture into a string in Base64 format and store it in the MySQL database. The field type is longtext.
(2) Error in front-end display picture
Get the picture data from the back end through the post request and assign it to Src. As a result, the picture cannot be displayed and an error: net::ERR_CONNECTION_RESET 431 (Request Header Fields Too Large)
(3) Problem-solving
Add “data:image/jpeg;base64,” before the base64 format string.
this. form. userPhoto=”data:image/jpeg;base64,”+this. form. userPhoto;
Here, image/JPEG is the name of the data type, Base64 is the encoding method, and the data after the comma is the data taken from the database. You can also check the data URL on the Internet.
So the problem is solved.
Read More:
- [Solved] nodejs Error: request entity too large
- [Solved] Vue2 Cross-domain Error: AxiosError net::ERR_FAILED, Network Error, ERR_NETWORK
- [Solved] /sockjs-node/info?t= net::ERR_SSL_PROTOCOL_ERROR
- How to Solve Files Upload Error: http://net::ERR_SSL_PROTOCOL_ERROR
- [Solved] Failed to load resource: net::ERR_FILE_NOT_FOUND
- [Solved] Deploy the front-end package online. Net:: err_SSL_PROTOCOL_ERROR
- [Solved] Package Install Error: npm ERR code ERR_SOCKET_TIMEOUT npm ERR
- [Solved] NPM err! Cannot read property ‘parent’ of null npm ERR! A complete log of this run can be found in: npm ERR!
- “Failed to load resource: net::ERR_FILE_NOT_FOUND” error. The project created by vue-cli 3.0 can run under dev, and an error is reported after packaging, and the page is blank.
- If the request parameter is formdata, use the Ajax operation
- Vue Dynamic Display Picture Error 404: Not Found [How to Solve]
- [Solved] Vue3 npm ERR code ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
- How to Solve Webpack packag iconfont font error
- Vue picture display 403 error [How to Solve]
- Vue mutui identify (Image Verification Code)
- Vue JS import font.css error [How to Solve]
- Cesium.js:1 Error loading image for billboard: [object Event]
- [Solved] ajax Error: Uncaught SyntaxError: Unexpected end of JSON input
- [Solution] VUE.js Load a local image with parameters in the script
- Solve Google browser font reduction to 12px