Strange FTP issue when remote transferring.

All posts relating to Oracle PL/SQL development.

Moderator: Tim...

Strange FTP issue when remote transferring.

Postby ngac » Mon May 21, 2012 2:22 pm

I have a file (.fmx form module) which is 173,480kb in size before uploading to FTP. I use a FPT file transfer and when viewed on FTP site it is still same size. If I download it using FTP program it is still same as you expect.

If i use the FTP package and below code
Code: Select all
 l_conn       := ftp.login('host', 'port', 'user', 'password');
  ftp.put_local_binary_data(ftp.get_remote_binary_data((p_conn => l_conn, p_file => 'forms_folder' || '/' || 'form.fmx'),'FORMS_LOCATION','form.fmx');
  utl_tcp.flush(l_conn);
  ftp.logout(l_conn);
  utl_tcp.close_connection(c => l_conn);


The downloaded file is now 173,968 in size and is corrupt.

Any ideas what im doing wrong?
Also tried saving to table and it was the larger size in the table.
ngac
Member
 
Posts: 7
Joined: Tue Aug 18, 2009 8:13 am

Re: Strange FTP issue when remote transferring.

Postby Tim... » Mon May 21, 2012 3:01 pm

Hi.

What happens if you do this:

Code: Select all
DECLARE
  l_conn  UTL_TCP.connection;
BEGIN
  l_conn := ftp.login('host', 'port', 'user', 'password');
  ftp.binary(p_conn => l_conn);
  ftp.get(p_conn      => l_conn,
          p_from_file =>'forms_folder' || '/' || 'form.fmx',
          p_to_dir    => 'FORMS_LOCATION',
          p_to_file   => 'form.fmx');
  ftp.logout(l_conn);
END;
/


Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog
Tim...
Site Admin
 
Posts: 17953
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK

Re: Strange FTP issue when remote transferring.

Postby ngac » Mon May 21, 2012 3:09 pm

That works like a dream.. What was I doing wrong and why does that work but other does not. I was actually storing in a table structure so i could check the length of the blob to see if a new revision had been added or not which i wouldnt be able to do doing it directly with the get procedure.

Thanks for your quick response btw!
ngac
Member
 
Posts: 7
Joined: Tue Aug 18, 2009 8:13 am

Re: Strange FTP issue when remote transferring.

Postby Tim... » Mon May 21, 2012 4:48 pm

Hi.

Not totally sure, but I think it comes down to this:

Code: Select all
  ftp.binary(p_conn => l_conn);


You were calling the binary routines, but you had not set binary mode before starting. The difficulty with ascii mode is some characterset conversions can occur and screw things up.

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog
Tim...
Site Admin
 
Posts: 17953
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK


Return to Oracle SQL and PL/SQL Development

Who is online

Users browsing this forum: No registered users and 2 guests