Results 1 to 4 of 4

Thread: Internet Transfer Control: Uploading binary files? *resolved*

  1. #1

    Thread Starter
    Fanatic Member arsmakman's Avatar
    Join Date
    Dec 2001
    Location
    Leiden, Netherlands.
    Posts
    719

    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.
    Last edited by arsmakman; Dec 22nd, 2004 at 05:33 AM.
    No matter how fool-proof your program is, there will always be a better fool.

    Was a post helpful to you? Rate it!

  2. #2
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Talking Re: Internet Transfer Control: Uploading binary files?

    other way: winsock? (lookup: Imports System.Net.Sockets)
    Last edited by Ruku; Dec 21st, 2004 at 08:11 PM.

    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  3. #3
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    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
    "The dark side clouds everything. Impossible to see the future is."

  4. #4

    Thread Starter
    Fanatic Member arsmakman's Avatar
    Join Date
    Dec 2001
    Location
    Leiden, Netherlands.
    Posts
    719

    Smile 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!
    No matter how fool-proof your program is, there will always be a better fool.

    Was a post helpful to you? Rate it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width