Android Question An Observation Concerning HttpUtils2

mjtaryan

Active Member
Licensed User
Longtime User
I've been playing with HttpUtils2 (both the library and Erel's modified version for very large files) and have observed an interesting phenomonen.

I've been using my Dropbox pubic folder as the download source. When I copy three types of files (html, jpg and txt) directly from my computer to my device or when I export the files from Dropbox to the device all three types of files are readable by my app AND by other, commerical, apps (the browser for the html, note editor for the txt and the image viewer for the jpg).

However, when I use the HttpUtils2 methods to download the same files from Dropbox, these files are readable/useable by my app but will not open in other commerical apps. I have no idea why that is. It occurs to me that the cause may be with Dropbox or it might possibly be something about HttpUtils2. I don't know if this would occur were I downloading from another site. Again, I have no ideas as to the cause.

Any thoughts?
 

mjtaryan

Active Member
Licensed User
Longtime User
If the file was downloaded successfully and copied correctly to the SD card then the file is there like any other file. It doesn't have any special relation to your app.

Try to use a file explorer app to see the file contents.

I wasn't saying there was a special relationship with my app. I have used a file explorer. That's how I know the downloaded files are where I saved them and that they will not open in other apps. I get error messages when I try to open them. They do open and do display in my app. I was merely commenting on an anamoly.
 
Upvote 0

mjtaryan

Active Member
Licensed User
Longtime User
Can you post your code?

Sure. Here it is.

There are two source code files: "DownloadTestOriginalUsingGet.b4a" and "DownloadTestUsingModifiedUtils.b4a". The first uses the "GetString" and "GetBitmap" methods of the HttpUtils2 library. The second uses the input/output streams from your modified version of HttpUtils2 posted for large files. Both download the files to the DefaultExternal directory and can be opened and used in one of my apps but the I am unable to open those files in any other app.

Please bear in mind these tests were done to familiarize myself with the download methods and, therefore, I was not concerned about writing efficient and elegant code. Thanks for your help.
 

Attachments

  • DownloadTests.zip
    9.6 KB · Views: 242
Upvote 0

mjtaryan

Active Member
Licensed User
Longtime User
I've tried DownloadTestOriginalUsingGet. The files were saved to external storage. I then used a file explorer to reach the files and were able to open them.

In view of your above reply I installed a couple of additinal file explorers and tried them after rerunning the test app. The dwnloaded files opened correctly. Apparently my usual file explorer, ES File Explorer, has a problem I hadn't encountered until now and under these conditions. I thought I had frgtten something or had some other problem with my code. Thank you.
 
Upvote 0
Top