- If I put this URL:
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")
(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
( pS 88d1e1c4e2128b2d_a67ce4a01b
440ee1551724e8836b0591 Y@ PNG
IHDR >a pHYs
UN-DAMAGED FILE BEGINNING
PNG IHDR >a
- 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