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:\Temp\Test1.txt');
    text_io.put_line(outfile,'send D:\Temp\Test2.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;


posted @ 2016-12-25 22:27  全威儒  阅读(494)  评论(0编辑  收藏  举报