I need to send an image using XMLHttpRequest
I'm only able to read the image as binary values like this "\xFF\xD8\xFF....etc"
Could you please let me know how i can achieve this using ArcGIS Runtime Qt SDK QML.
Thanks in advance.
If you're using AppStudio for ArcGIS, there are several ways for working with images and uploading.
1. NetworkRequest has built in support for multipart/form-data if it detects a file upload in the request (similar to Unix curl command).
file: networkRequest.uploadPrefix + "myimage.png"
This is the best method, because (a) your application logic is simple, (b) the file is not loaded into memory, but streamed in blocks directly from file to the internet, allow one to upload very large files, (c) you needn't worry about setting your headers correctly for a multipart/form-data upload, this is done for you automatically.
2. We have File and BinaryData object for reading a file and converting it to another format, e.g. base64 encoding
Thanks for your response.
you mentioned that the NetworkRequest detects a file in the request,
Is this happens because in the body object you added a file property, if so what if the object is complex and has more properties not only file and f
and the property name not file --data instead.
Will the NetworkRequest still going to detect that a file in the request and set the headers to "multipart/form-data"
Also i tried to use Binarydata several times, but no luck till now to convert the image to (URL Encoded format).
the following is example of an image after reading its data as URL encoded format, and this allows me to send it using and
If you copy and paste the previous value on the browser, an image will be shown.
Could you please let me know if there is a way that allows me to convert the image data into that format.