- If I put this URL:
https://resources.eveonline.com/88/88d1e1c4e2128b2d_a67ce4a01b440ee1551724e8836b0591
into a browser I get a downloaded PNG file named 88d1e1c4e2128b2d_a67ce4a01b440ee1551724e8836b0591 without the extension.
-
Adding an extension (in this case .png) to the file name allows me to open the file as a png and view the picture as it is intended to be seen.
-
If I use httpSocket to download this same file with the following code:
Dim http As New HTTPSocket
Dim f as FolderItem = SpecialFolder.Desktop.Child("resDLData.png")
http.Get(lblItem02.Text, f)
(where lblItem02.Text contains the URL from item 1 above for the file I want to grab)
3) The file downloads as expected with the name resDLData.png and is found on the Desktop as expected.
- Attempts to open the file results in the following message:
It may be damaged or use a file format that Preview doesnt recognize.
5) Previews default file format is .png so it should open right up
- Comparing the two files (the one from item 2 and the one from item 3) with a hex editor reveals that there is extra data at the beginning and end of the damaged file which isnt there on the undamaged file.
[code]DAMAGED FILE BEGINNING
=============ASCII===================
( pS 88d1e1c4e2128b2d_a67ce4a01b
440ee1551724e8836b0591 Y@ PNG
IHDR >a pHYs
==============HEX====================
1F8B080828EA705302FF383864316531633465323132386232645F61363763653461303162
3434306565313535313732346538383336623035393100005940A6BF89504E470D0A1A0A00
00000D4948445200000080000000800806000000C33E61CB000000097048597300000B1300
UN-DAMAGED FILE BEGINNING
=============ASCII===================
PNG IHDR >a
pHYs
==============HEX====================
89504E470D0A1A0A0000000D4948445200000080000000800806000000C33E61CB00000009
7048597300000B1300
[/code]
- The damaged file actually has the name of the downloaded file in that extra data leading me to believe that a header of some sort remains on the downloaded file.
What am I forgetting/doing wrong? Shouldnt the file downloaded using HTTPSocket match the file downloaded manually?
OS X 10.12.5
Xojo 2017 r1.1