Home » D2k » Upload Files To FTP in Oracle Forms D2k

Upload Files To FTP in Oracle Forms D2k

Upload Files To FTP in Oracle Forms D2k

Use following procedure to upload files to Ftp. 

PROCEDURE Ftp_Upload IS
    outfile text_io.file_type;
BEGIN
    -- write a ftp script
    outfile := text_io.fopen('D:ftpsendsource.ftp', 'w');
    text_io.put_line(outfile, 'open yourftpurl');
    text_io.put_line(outfile, 'youruser');
    text_io.put_line(outfile, 'yourpassword');
    text_io.put_line(outfile,'binary');
    text_io.put_line(outfile,'send D:TempTest1.txt');
    text_io.put_line(outfile,'send D:TempTest2.abc');
    text_io.put_line(outfile,'disconnect');
    text_io.put_line(outfile,'bye');
    text_io.fclose(outfile);
    host('cmd /c ftp -s:d:ftpsendsource.ftp');
    exception
         when others then
           if text_io.is_open(outfile) then
                   text_io.fclose(outfile);
           end if;          
           message(sqlerrm);
END;