This discussion is archived
5 Replies Latest reply: Aug 2, 2011 8:12 AM by mobra RSS

Transferring file from APEX application to FTP folder

878717 Newbie
Currently Being Moderated
Hi All,
I've an APEX application where-in I have an APEX File-Browse Item. I want to transfer the selected file (from my desktop) to some FTP Path; is this possible. I know Calling UNIX command would serve the purpose. But is that feasible with APEX application and that too when the data file is in our desktop; is that could be transferred to FTP Path??

Rgds,
HSR!!
  • 1. Re: Transferring file from APEX application to FTP folder
    fac586 Guru
    Currently Being Moderated
    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and ensure you have updated with your profile with a real handle instead of "user12210772".

    You'll get a faster, more effective response to your questions by including as much relevant information as possible upfront. This should usually include:

    <li>Full APEX version
    <li>Full DB version and edition
    <li>Web server architecture (EPG, OHS or APEX listener)
    <li>Browser(s)/version(s) used
    <li>Theme
    <li>Templates
    <li>Region type
    I've an APEX application where-in I have an APEX File-Browse Item. I want to transfer the selected file (from my desktop) to some FTP Path; is this possible.
    What is an "FTP path"?
  • 2. Re: Transferring file from APEX application to FTP folder
    mobra Journeyer
    Currently Being Moderated
    I've an APEX application where-in I have an APEX File-Browse Item. I want to transfer the selected file (from my desktop) to some FTP Path; is this possible. I know Calling UNIX command would serve the purpose. But is that feasible with APEX application and that too when the data file is in our desktop; is that could be transferred to FTP Path??
    Hi,

    If I understand your question correctly, you want to upload a file from your local machine to Apex (ie the database server), and then send it to an FTP server somewhere else.

    In Apex, create a file upload item.

    Then, in a process on that page, you grab the BLOB data from the Apex upload table, and send this to an FTP server via FTP.

    You'll find a package called FTP_UTIL_PKG in the Alexandria Utility Library for PL/SQL, which allows you to use FTP from within PL/SQL:

    http://code.google.com/p/plsql-utils/

    - Morten

    http://ora-00001.blogspot.com
  • 3. Re: Transferring file from APEX application to FTP folder
    878717 Newbie
    Currently Being Moderated
    Hi Morten,
    Thanks for the reply and YES.. you understood my question correctly.
    I am using a FILE BROWSE item in my APEX application. I understand that when I upload the file, the details goes into the table wwv_flow_files. Normally I just grab the BLOB_CONTENT, create collections and parse the data. I have done that before.

    But Here my issue is that I need to transfer that file to FTP server and change the encoding of the same (We use shell script for the same...we used successfully in the past). So HOW to transfer the file is my concern.

    As You mentioned and I quote " In a process on that page, you grab the BLOB data from the Apex upload table, and send this to an FTP server via FTP ". We normally use a java stored procedure to call the Unix commands inside Pl/sql as mentioned in the links which you have given. But even for using that unix command I need to transfer the file to ftp server. Otherwise say if I am using CP Command..what would I give the 'present path'?
    cp <present path>/FileNAME <Destination Path>/Filename.

    Dest path I would give of ftp path.. where I would like to keep the file. But presently the file is in APEX, so how we give the 'original path'? In other words, how would I transfer the BLOB_CONTENT to the ftp server?

    Thanks in advance.

    Rgds,
    HSR!!
  • 4. Re: Transferring file from APEX application to FTP folder
    fac586 Guru
    Currently Being Moderated
    Chris Poole's XUTL_FTP package can put BLOBs directly from the database to a remote server.
  • 5. Re: Transferring file from APEX application to FTP folder
    mobra Journeyer
    Currently Being Moderated
    Dest path I would give of ftp path.. where I would like to keep the file. But presently the file is in APEX, so how we give the 'original path'? In other words, how would I transfer the BLOB_CONTENT to the ftp server?
    You get the file from the Apex upload table, select it into a BLOB, and then you just pass that BLOB on to one of the upload procedures that accepts a BLOB parameter.

    See the package specification of Tim Halls' FTP package here:

    http://www.oracle-base.com/dba/miscellaneous/ftp.pks

    More info:

    http://www.oracle-base.com/articles/misc/FTPFromPLSQL.php

    - Morten

    http://ora-00001.blogspot.com

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points