CodePudding user response:
CanThe client to send, you put the pictures in advance in a function to flow, and then return to QString type, and then send it according to your agreement with the other text line, this is to convert images to flow, and then returns a QString types;
QImage image (fileName);
The QBuffer buffer;
Buffer. The open (QIODevice: : ReadWrite);
Image. The save (& amp; Buffer, "JPG");
QByteArray array;
Array. Append (buffer. The data () toBase64 ());
QString string (array);
QDebug () & lt;
Server receives, in an image when using this function
QString filename="1. JPG";
QString pathname="D:/management_system/item/Server/QRC checkimage/" + filename.
QByteArray array;
Array. Append (string);
QImage image;
Image. LoadFromData (array. FromBase64 (array));
Image. The save (pathname);//to save image to the local