Send a file over XMLHttpRequest in pure QML?

I’m not sure I get what you’re trying to achieve, (EDIT: ok, it IS about Binaries so the rest here is blah, blah) I’ll have a look see (ignore the original)

EDIT 2: maybe

image.src = "data:image/gif;base64," + encode64(xhr.responseText);

Using python should be possible with a QML only app. So it shouldn’t need to target an arch. Unless you’re doing (like I frequently do) something like adding cython stuff. For pure python, should be noarch?

I think just loading an image into canvas and then:
string toDataURL(string mimeType )
should provide a usable string that can be posted/put (if tobase64 is not borked here since it’s <5.8 Qt), I did end up using python in this case

cool. could you post your python + qml solution? would probably come in useful!

Python code wasn’t mine, I just tweaked it a bit after abandoning the full QML posting idea, doubt it will be useful to anyone as the codebase is quite big and a bit of a mess as not very actively maintained anymore, but here’s the pull: https://github.com/tabasku/harbour-neliapila/pull/76

Ok, thanks! I’m going to look at a base64 method. If I don’t forget while debugging everything else. sigh.

So… even though Qt 5.5 added typed array support, qml xhr still to this day doesn’t support sending arrays:
https://codereview.qt-project.org/c/qt/qtdeclarative/+/143732

What the hell are Qt guys doing, they had ready to use code 7 years ago and are sitting on another solution for 5 years. So, no sending of binary strings, and since discourse expects that, the only option seems to be a third party uploader that accepts base64, so test

1 Like