File Download via HTTP and FTP

I have been working on a solution for file download.  I am now able to download both binary and text files both via http and ftp and both with Classic Client and Role Tailored Client.

Attached is a codeunit that can download a text file via http, a zip file via http and a text file via ftp.  I use dotnet object for the Role Tailored Client to handle files on the client side.

FileDownload

4 Replies to “File Download via HTTP and FTP”

  1. Hi Gunnar,
    Very nice little tool. Works fine, files are imported. But I’m having issues with the text encoding. The file I’m downloading is a CSV file in Windows format.
    And it contains some of the danish Ă†Ă˜Ă… characters.

    After the import, I’m calling an XMLport to read the data, directly from the blob field. It had no effect to add the Windows encoding here.
    I then tried to save the actual data to a file, using FILE.WRITE(HTTPRequest.responseText); and here I can see that the data are “messed” up already before they get into NAV.
    Any suggestions?
    /Erik

  2. Hi Gunnar,

    I was trying to use your DownloadFTPFile function to download text file from FTP server.
    I have a confustion regarding this TempFileName variable and because of this it is giving me following error. Please guide me.
    —————————
    Microsoft Dynamics NAV Classic
    —————————
    The operating system cannot find the file D:UsersT14239AppDataLocalTempnrdata.txt .

    Verify that the drive, directory, and file names are correct.

    —————————
    OK
    —————————

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.