Hi,
In my last post i was not able to send picture , now i can send an image to my private server with hardcode base64 data,.
But i don't know how to convert an image(i have only url of that image) to base64 string, so that i can send it through xmlhttprequest,
The above is possible in html with javascript, but how to do it in qt quick javascript.
https://www.codegrepper.com/code-examples/cpp/convert+image+to+base64+javascript
I got this link below for qt but want to do it through js.
https://felgo.com/developers/forums/t/upload-jpeg-to-server-created-from-camera
Exactly i m doing the same like selecting pictures from group send an array of picture to my private server.
Solved! Go to Solution.
Hi @rsharma,
If you are using AppStudio, then, you can do this in QML using NetworkRequest and setting the responseType to "base64". Alternatively, if the uri is to a local file, you can use the File and BinaryData objects together.
If you are not using AppStudio, then, but are using C++, then, you can use the QNetworkAccessManager to download your uri content. The resultant QByteArray and be converted to base64 using QByteArray::toBase64. (See https://doc.qt.io/qt-5/qbytearray.html#toBase64 )
Let me know if you need further information on either of these two strategies.
Stephen
Hi
Please anyone ellaborate ME HOW TO CONVERT IMAGE TO BINARY or ARRAYBUFFER, SO THAT FURTHER I CAN CONVERT IT INTO BASE64
Hi @rsharma,
If you are using AppStudio, then, you can do this in QML using NetworkRequest and setting the responseType to "base64". Alternatively, if the uri is to a local file, you can use the File and BinaryData objects together.
If you are not using AppStudio, then, but are using C++, then, you can use the QNetworkAccessManager to download your uri content. The resultant QByteArray and be converted to base64 using QByteArray::toBase64. (See https://doc.qt.io/qt-5/qbytearray.html#toBase64 )
Let me know if you need further information on either of these two strategies.
Stephen