Nav Export File to FTP

armela20armela20 Member Posts: 71
Hi there.
I need to creata an export file and place it in an ftp site.
I will need to run this from the Job Scheduler, so I know I have to create a codeunit or Report for it, which I am fine with.
However I am not sure about placing it in the Ftp site,
I have the FTP address, user name and password and the name that file needs to be.

I am not sure how to send the user name and password to the ftp.

Anyone has any ideas ???


Thanks

Comments

  • DakkonDakkon Member Posts: 192
    Whether you create the file via a dataport, codeunit or report, you will probably need a dll or ocx that provides an ftp component. Once that file is created you will create an instance of an automation object from the chosen dll/ocx and use it for the upload. There are many out there to choose from free and otherwise if you do some looking. Keep in mind, the dll/ocx that you choose to use will need to be on the machine this task will run from and it will have to registered. You can manually register an activex dll/ocx file using the Regsvr32.exe program. You can find out more about this online as well. Microsoft has a redistributable activex ocx component for ftp you can use. If you have visual studio 6, this component should be on your machine. As I said, however, there are more than a few to select from out there.
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
  • armela20armela20 Member Posts: 71
    thanks for the info, however a little bit more detail would be appreciated.

    which DLL or OCX do you suggest that I can use ??


    Thanks
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    As you can open an FTP site simply from windows explorer and copy files there just as if it was a folder, I wonder whether you could set up the FTM site as a network drive, like, Z: and just export there. I think this might be possible.
  • fverkelfverkel Member Posts: 66
    You can use ftp.exe, which is part of Windows.

    I have used this.
    Frst I build a command file which contains the commands for FTP, then I pass this file to FTP.EXE.
    Something like this. CommandsFile has DataType File.


    CommandsFileTxt := ENVIRON('TEMP') + '\NavFTP_CommFile.txt';

    CommandsFile.TEXTMODE(TRUE);
    CommandsFile.WRITEMODE(TRUE);

    CommandsFile.CREATE(CommandsFileTxt);

    CommandsFile.WRITE('Username');
    CommandsFile.WRITE('Password');
    CommandsFile.WRITE('Put ' + 'C:\data.txt ' + 'OurData.txt');
    CommandsFile.WRITE('Quit');

    CommandsFile.TRUNC;
    CommandsFile.CLOSE;

    SHELL(STRSUBSTNO('ftp.exe -s:"%1" %2', CommandsFileTxt, 'ftp.somewhere.com'));
    Keep It Simple and Stupid (KISS), but never oversimplify.
  • DakkonDakkon Member Posts: 192
    I do not have a particular one I would suggest simply because I have not had to use any thus far and I cannot tell you from experience which would be more reliable. It is fairly easy to find some on the net, but as to how reliable or easy to use each is, I could not tell you without researching that. Hopefully someone else here might suggest an ftp component that they recommend. The best I could do is find a few on the net and point you at them, but I would not be able to vouch for them. Unfortunately the microsoft one I was thinking of is not very user friendly unless you are intimate with the FTP protocol. I will do a quick search in a bit and post some pointers to anything that looks worthy of investigation. In the end, you will most likely have to try some different ones.
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
  • nunomaianunomaia Member Posts: 1,153
    When I want to upload files through FTP I use FTP command line tool. You can use that, you don’t to install any component to use by this way.
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • DakkonDakkon Member Posts: 192
    Very good point. The ftp shell command should work just fine, you could setup a batch script file to run all the commands even and simply execute the batch file from within your dataport once you have finished writing the file. The only reason you would ever really need to use an activex component is if you want more control over the process as it occurs, or if you want to control what the comes up on screen. If you do decide to dabble with automation controls, the only reliable looking ones I found with a quick search are all pay components. The price ranges from $40 to $200 it looks like. The components are:
    Chilkat's activex ftp component
    Dart's FTP for ActiveX (part of the PowerTCP series)
    nSoftware's IP*Works! ftp component
    nBit Easy FTP DLL

    You can search for any of these and find them rather easily. I'm not as familiar with the nBit one. The other names have been around a while and are likely reputable, but as always, do you own research and find out for yourself:)
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
  • nunomaianunomaia Member Posts: 1,153
    You don't need to have a batch file. You can use Wscript.shell automation to execute FTP.
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • DakkonDakkon Member Posts: 192
    I didn't say you needed one, I said "you could" use one. ;p
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
  • Revolution1210Revolution1210 Member Posts: 161
    Many options available. A couple of ideas:

    Using the built in Windows ftp client

    Using CuteFTP
    Ian

    www.NextEqualZero.com
    A technical eye on Dynamics NAV
Sign In or Register to comment.