Internet Transfer Control: Uploading binary files? *resolved*
Hello,
I am trying to upload encoded files using the Internet Transfer Control (Inet) to a private FTP-site. Now the problem is that when the file is uploaded it's content changes (some characters are replaced with a couple of new ones) and the decoding of the file will not work anymore. :( (See example below)
The solution will most likely be that the file should be uploaded in Binary mode, but is this possible with the Inet control? And if not, how can I do this another way? (I have full access to the FTP-server)
Thanks a million! ;)
Example:
File content: "Hello" -> Encoding -> "©ÑçÁ²" -> Stored to file -> "©ÑçÁ²" -> Stored to web -> "ÂéÑ╣¥Á²" -> Decoding -> Crap.
Re: Internet Transfer Control: Uploading binary files?
other way: winsock? (lookup: Imports System.Net.Sockets)
Re: Internet Transfer Control: Uploading binary files?
Hi arsmakman
You are correct switch to binary mode before transfering.
There the System.net.Webclient.UploadFile method.
There a free control called Indy, it implements lots of internet protocols including pop3,imap,smtp,ftp, etc...
Check out the site http://www.indyproject.org/Indy.html
Regards
Jorge
Re: Internet Transfer Control: Uploading binary files?
Thanks Ruku and Asgorath, but I found a very simple and useable way to upload the files correctly.
I tried upload a file containing all excisting characters (Chr(1) to Chr(255)) to see what they would become when uploaded, but then the file uploaded correctly and wouldn't display as text in my browser. It was a binary(!) file.
My encoded files only contained normal text characters (Chr(32) and above) and automatically they were seen as text files, and uploaded that way. Uploading the file in textmode changed some characters to two new characters. (Probably due to some text-encoding transformations) Now, by starting the file with a Chr(1) it is reconized as a binary file and all characters binarily and they are uploaded correctly!
Then just strip-off the first character and decode and my file is back to normal!