Hello,
I am looking for the way how to download and save binary files (up to 1GB).
I found out that with direct QML is not possible to save the file. AppStudio has FileFolder class with writeFile function, but it seems that it writes only text files.
I got downloading working somehow, with QML XMLHttpRequest, but I think it is not usable for large files because you have to read the whole file in memory.
Does anybody use downloading and saving files in QML?
Thank in advanced,
Zdenek J.
Solved! Go to Solution.
Hello Zdenek J.,
The best component for this is the NetworkRequest object and setting the responseFile attribute. This will ensure that the file is downloaded directly to file whilst keeping a low memory footprint.
Stephen
Hello Zdenek J.,
The best component for this is the NetworkRequest object and setting the responseFile attribute. This will ensure that the file is downloaded directly to file whilst keeping a low memory footprint.
Stephen
Hi Stephen Quan,
thank you for this reference, I wasn't able to find it on my own in the help/doc.
It is in ArcGIS.AppFramework. There is a Esri Sample using it as well: http://www.arcgis.com/home/item.html?id=bfb0dec97a254a0d9d609a3e3cc95598 - better to search it through AppStudio itself.
Thanks, I will give that a try.
Zdenek J.
Hi all,
I would like to have one more question: is there any chance to use NetworkRequest object to download files from secured web folder, e.g. HTTPS Basic Authentication?
Or I am not sure if it would be possible to upload our files (around 750MB each) to Portal and then downloaded from Portal with portal credentials in the play.
Thanks for comments on this.
Zdenek J.
Hello Zdenek J.,
Sorry for the late response. HTTPS is subject to the SSL algorithms that your device is capable of.
Having said that, I would expect that every device supports HTTPS Basic Authentication.
The other thing to clarify is which HTTP method are you using to upload? HTTP GET? HTTP POST? Or something else? i.e. HTTP PUT?
Stephen
Hi,
thank you for clarification.
I see, I have written my last post quite confusing. Workflow with the app is this:
Well I hope I put it on the right track.
Thanks,
Zdenek J.
Hi Zdenek,
If you refer to the AppStudio Framework Runtime, there are a number of Portal objects that you can use to build to browse Portal Items:
- Portal
- PortalDownloadUserContent or PortalSearchItems
- PortalDownloadItemInfo
- PortalDownloadItemData
- When running Qt Creator, select Help and open AppStudio Framework Runtime
Alternatively, if you want to use the NetworkRequest object, you can directly access the REST API or connect to any web server to download the package. As your data is secured behind HTTPS, there are a number of HTTPS considerations when using the NetworkRequest object:
- Handle SSL certificate challenge correctly via onSslErrors / on sslErrorsIgnored signals and the ignoredSslErrors property
- If HTTPS is secured, supply credentials (i.e. username / password)
As to your specific Basic Authentication support question, that's really up to the SSL algorithms installed on your device. Basic Authentication, I would expect, to be universally available.
Stephen