Uploding file through FTP

Hi
How can i upload file and download file through FTP server .is any body has some sample code.pls help me
Thanks!!

I think there one undocumented sun.net.ftp
U can try with that pkg...Better yet, don't.
Why Developers Should Not Write Programs That Call 'sun' Packages
http://java.sun.com/products/jdk/faq/faq-sun-packages.htmlI recommend the Jakarta Commons Net package...
http://jakarta.apache.org/commons/net/

Similar Messages

  • Is it possible to upload large files through FTP to server with iWeb?

    Is it possible to upload large files through FTP to server with iWeb like for example with Cyberduck?
    I don't need to publish website with files, I just need to upload files on server. Can it be done somehow with iWeb?

    Here's some info about FTP...
    http://www.iwebformusicians.com/Search-Engine-Optimization/Upload.html
    Make sure you are allowed to store files on your server. Most hosting services don't allow anything to be stored that can't be accessed via the internet. Check the fine print!

  • Can anyone help me in sending a file through FTP

    i have written a program to transfer files or directories in zipformat through FTP.i have also installed filezella server to check whether it is working or not.i have connected to filezella server but i am not able to send file.can any one send the code for sending the file.
    i have also tried the jakarta api sendfile ().but in that i don't what is mode means.
    for your reference i am sending the code as far developed.
    import java.io.*;
    import java.util.*;
    import java.util.zip.*;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipInputStream;
    import org.apache.commons.net.ftp.*;
    import org.apache.commons.net.tftp.*;
    class FTPTransfer
    static public void main(String[]p)
    FTPTransfer ob = new FTPTransfer();
    // ob.Create_Zip_File(new File("outfile.zip"),new File[]{new File("c:\\trialtwo")}, false);
    ob.ftpConnect();
    // connecting to FTP server
    public void ftpConnect()
    boolean error = false;
    FTPClient ftp = null;
    try
    int reply;
    //ftp.connect("ftp.comcast.com");
    ftp = new FTPClient();
    ftp.connect( "localhost",21);
    // ftp.login( username, password );
    System.out.print("reply from FTP Server :"+ftp.getReplyString());
    // After connection attempt, you should check the reply code to verify
    // success.
    reply = ftp.getReplyCode();
    if(!FTPReply.isPositiveCompletion(reply)) {
    ftp.disconnect();
    System.err.println("FTP server refused connection.");
    System.exit(1);
    // ftp.sendFile();
    // transfer files
    // ftp.logout();
    TFTPClient tftp = new TFTPClient();
    System.out.print("before sending");
    tftp.sendFile("c:\\trialtwo\\a-1.txt",1,new FileInputStream("c:\\trialtwo\\a-1.txt"),"localhost",21);
    System.out.print("after sending");
    catch(IOException e)
    error = true;
    e.printStackTrace();
    finally
    if(ftp.isConnected())
    try
    ftp.disconnect();
    catch(IOException ioe)
    // do nothing
    System.exit(error ? 1 : 0);
    //send files
    // filename - The name the remote server should use when creating the file on its file system.
    // mode - The TFTP mode of the transfer (one of the MODE constants).
    // host - The remote host receiving the file.
    //port - The port number of the remote TFTP server.
    private void listContents( File Zip_File, File dir, ZipOutputStream out )
    throws Exception
    String[] files;
    files = dir.list();
    byte[] buf = new byte[1024];
    File[] file = dir.listFiles();
    for (int i = 0; i < file.length; i++) {
    System.out.println("*********** "+file);
    // File f = new File(dir,file[i]);
    try{
    FileInputStream in = new FileInputStream(file[i]);
    out.putNextEntry(new ZipEntry(file[i].getPath()));
    int len;
    while((len = in.read(buf)) > 0) {
    out.write(buf, 0, len);
    in.close();
    catch(Exception e)
    zipEntry(Zip_File, file[i], out);
    } // end listContents()
    void Create_Zip_File(File Zip_File,File[] To_Be_Zipped_Files,boolean Skip_Dirs)
    try
    // Open archive file
    FileOutputStream stream=new FileOutputStream(Zip_File);
    ZipOutputStream out=new ZipOutputStream(stream);
    for (int i=0;i<To_Be_Zipped_Files.length;i++)
    //if (To_Be_Zipped_Files[i]==null
    // || !To_Be_Zipped_Files[i].exists()
    // || (Skip_Dirs ))
    // continue;
    System.out.println("Adding "+To_Be_Zipped_Files[i].getName());
    zipEntry(Zip_File, To_Be_Zipped_Files[i], out);
    out.close();
    stream.close();
    System.out.println("Finished zipping : "+ Zip_File.getAbsolutePath());
    catch (Exception e)
    e.printStackTrace();
    System.out.println("Error: " + e.getMessage());
    return;
    private void zipEntry(File Zip_File, File file, ZipOutputStream out) throws Exception
    if (file.isDirectory())
    listContents(Zip_File, file, out);
    return;

    You'll stand a better chance of getting help if you're more specific about what problems you're encountering. "Can't send file" doesn't say much.
    When you post code, please use[code] and [/code] tags as described in Formatting tips on the message entry page. It makes it much easier to read.

  • Sending files through FTP

    task is to take files or folders and ZIP it and send it through FTP.i was able to take the files and folders and zip it ,I was able to connect to FTP server but to send the file what code shoud i use.

    Multipost:
    http://forum.java.sun.com/thread.jspa?threadID=729985

  • Error while reading files through FTP Adapter

    Hi,
    I am using FTP Adpater to read files and archive in local folders.
    But i got the following errors when i deployed the process:
    <2008-12-18 13:48:31,140> <INFO> <default.collaxa.cube.activation> <File Adapter
    ::Inbound> Connection Created
    <2008-12-18 13:48:31,390> <ERROR> <default.collaxa.cube.activation> <File Adapte
    r::Inbound> Unable to get Binary file '/MySharedFolders/abc/AAAA_TT_
    Trrrrplan Bireeee Baaaa? ??ketmmllri Ltd.?ti._4673651.pdf'; FTP command RETR returned unexpe
    cted reply code : 550
    <2008-12-18 13:48:44,156> <INFO> <default.collaxa.cube.activation> <File Adapter
    ::Inbound> Managed Connection Created
    <2008-12-18 13:48:44,156> <INFO> <default.collaxa.cube.activation> <File Adapter
    ::Inbound> Processer thread calling onFatalError with exception Error getting bi
    nary file from FTP Server.
    Unable to get binary file from server.
    Check the error stack and fix the cause of the error. Contact oracle support if
    error is not fixable.
    <2008-12-18 13:48:44,156> <FATAL> <default.collaxa.cube.activation> <AdapterFram
    ework::Inbound> [Get_ptt::Get(opaque)]Resource Adapter requested Process shutdow
    n!
    Please help me out on this issue.
    Thanks,
    Synthia

    Hi James,
    We have upgraded to 10.1.3.4. but still we could not read the file. the problem is, it could not read the file names contains with UTF-8 characters.
    error is below:
    <2009-12-01 15:43:33,109> <INFO> <default.collaxa.cube.activation> <FTP Adapter:
    :Inbound> Managed Connection Created
    <2009-12-01 15:43:33,109> <INFO> <default.collaxa.cube.activation> <FTP Adapter:
    :Inbound> Connection Created
    <2009-12-01 15:43:38,406> <ERROR> <default.collaxa.cube.activation> <FTP Adapter
    ::Inbound> Unable to get Binary file '/MySharedFolders/Invoice History/EMEA_TR_B
    imta?-Bo?aziτi Peysaz ?n?aat Mⁿ?avirlik Teknik Hizmetler A?aτ Sanayi ve Ticaret
    Anonim ?irketi_44596501.pdf'; FTP command RETR returned unexpected reply code :
    *550*
    <2009-12-01 15:43:51,156> <INFO> <default.collaxa.cube.activation> <FTP Adapter:
    :Inbound> Processer thread calling onFatalError with exception Error getting bin
    ary file from FTP Server.
    Unable to get binary file from server.
    Check the error stack and fix the cause of the error. Contact oracle support if
    error is not fixable.
    <2009-12-01 15:43:51,156> <FATAL> <default.collaxa.cube.activation> <AdapterFram
    ework::Inbound> [Get_ptt::Get(opaque)]*Resource Adapter requested Process shutdow*
    n!
    Thanks you.

  • Put File of a large file through FTP not working correctly

    I put a lot of large files to my web server through Dreamweaver, and when I get files larger than about 45 meg, the file is put fine to the server.  But then Dreamweaver waits for a server responce to make sure it got the file.  and after about 30 seconds or so, it says server timed out, and it starts over with the FTP, and the first thing it does on the start over is to delete the file.
    The only wai I have been able to put my large files to the server, is to sit and wait for it to finish, and then cancel the check for if the file is there or not.
    I have my FVT server timeout set to 300 seconds, but that does not help eihter.  it still times out after about 30 seconds.
    Is there a fix for this so I don't have to sit and watch my files being transfered to the server?

    I changed it to passive PTF, but that did not help, sending a 90 Meg file did the same thing.  What the problem is, is that the Dreamweaver FTP wants to verify that the file got there. and when you send that large of a file, the server wants to make sure it is a clean file, so it takes a while to put it to the correct location.  And while the server is doing this, Dreamweaver says that there is no responce from the server, and causes a reconnect.  and on the reconnect it starts over, and the first thing it does is to make sure the file is deleted.  What it should do it verify that the file is there and the same date as the one you sent up there.  That would eliminate this problem.  I was hoping there was a setting in Dreamweaver that I could tell the FTP not to verify the send.
    Are there any Dreamweaver developers that visit this forum. that could tell me how to bypas the verify on put.  It seams silly to have a tool that costs this much that can not do a task that a free pice of software can do.

  • Appending the Destination File through FTP using PL/SQL

    One of my requirement is I have to do the ftp using PL/SQL (My database is 10g on LINUX) ,
    What I know is i can do the FTP using the UTL_TCP and UTL_FILE packages that oracle provides, but inthis case requirent is ftp and append "APPEND" to the destination file.
    this is the command I use to FTP mannualy ....
    cd C:\Temp\Source\
    ftp
    open 999.99.99.99.99
    loginID
    ThePasWord
    ascii
    append CSOURCE.DAT M:\Temp\Destination\CDESTINATION.DAT
    close
    quit
    What I want to know is how to do this through PL/SQL
    I will appreciat this ...

    I got It...
    At
    http://www.oracle-base.com/articles/9i/FTPFromPLSQL9i.php
    Only Replace
    send_command(p_conn, 'STOR ' || p_file, TRUE);
    With
    send_command(p_conn, 'APPE ' || p_file, TRUE);

  • Dynamic name for File through FTP Adapter

    I am working on FTP Put and I have a requirement where in I have to generate the file with dynamic content in its name.I should actually embed a Purchase Order number in that file name follwed by a sequence number.I dont need any time stamp.Should I create a variable for this?
    Help in this regard would be highly appreciated.

    Hi,
    you have to enable the adapter specific parameter --> file name in both the sender and the receiver CC to get the input file name as output file name.
    Refer this blog:
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Also you need to use this udf
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    return  ourSourceFileName; 
    Also refer this blog:
    /people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping
    Regards,
    Nithiyanandam

  • Problem while reading multiple files through FTP Adapter

    Hi,
    We have a requirement to read the excel files placed in an FTP Location and as there is no Adapter to read Excel file
    we are using FTP Adapter and reading the Header values of the file(name of the
    file) and we are paasing as input to the Java code which will read the data nd insert into the Database.
    If we place above 20 files it was reading only some files and some were left and if we delete the files and place the unread files again some files are read and if we do the same procedure then all the files were read.
    Any help regaring this appreciated.
    Thanks and Regards,
    Nagaraju .D

    Are you doing anything complex for your polling, e.g. Files that must be n time old.
    Can you post the WSDL so I can see the polling configuration. I only need to see the adapter configuration, not the whole file.
    cheers
    James

  • Java Code to transfer a file through FTP

    I am writing a java code to transfer a file from local machine to a server on another machine.
    While uploading i am encountering with an exception which is showing as
    java.net.ConnectException: Connection refused: connect
    The file is getting transferred sucessfully if i am transferring it through command prompt instead of java code.
    Please help me out.

    Actually the code i have written is working fine when the two machines are local.
    But it is not working when the two syastems are connected through avantail.
    Then it is giving an exception
    java.net.ConnectException: Connection refused: connect
    while uploading

  • Cannot upload file through FTPS

    Hello,
    I am writing a FTPS Client (Explicit SSL) in java. For testing the same I am using the JScape FTP Server (Free Version). Altough have managed to login to the server, but cannot upload a file. Below is a brief description of the what's happeng in the code.
    1. Created a Socket
    controlSocket = new Socket(host, port);2. Issued AUTH TLS writer.write("AUTH TLS");3. Created controlSocket using SSLSocketFactory. Trusted all server SSL certificates.
    sslSocketFactory = sslContext.getSocketFactory();
    socket = sslSocketFactory.createSocket(socket, host, port, true);4. Issued the USER and PASS commands to login (Received success response)
    5. Issued TYPE A (Received success response)
    6. Issued PBSZ 0 and PROT P (Received success response)
    7. Issued PASV (Received success response)
    8. Retrieving the 'hostName' and the 'portNumber' from the reply for PASV
    9. Created dataSocket
    dataSocket = new Socket(hostName, portNumber);10. After the dataSocket creation, I am trying to retrieve the response from server when it is getting hanged.
    I don't have a clue why this is happening. Could someone help me with this.
    N.B. FileZilla Client however connects to the server and uploads data without any error.
    Edited by: saturn_cemk on Nov 13, 2009 1:22 AM

    I have also tried this... but it still hangs.
    dataSocket = sslSocketFactory.createSocket(remoteHost, remotePort);remoteHost and remotePort are the ones derived from the response for PASV.
    Do I need to do AUTH TLS again before creating the dataSocket ?? Am totally lost at this point.

  • File has to pass through FTPS connection.. Connection parameters?

    Hi,
    I want to transfer the file through FTPS connection. Partner side provided the following details as connection parameters.
    - IP : 129.32.169.140 
    - POrt: 990
    User name
    Password
    PASV mode
    SSL Direct, OpenSSL,SSL Listing, SSL Transfers.
    Kindly let me know what are all the parameters I need to pass in Receiver file adapter.
    FTP Connection Parameters:
    Server
    Port
    Data connection: Passive
    Connection Security:  FTPS for control connection or FTPS for control and Data connection.???
    Command Order :  ?????
    Please let me know what are the security and command order parameters I need to use in Receiver file adapter.
    They didn't provide any certificates.
    Thanks
    Deepthi.

    Hi Rajesh,
    The message is not even failing.. It is in the status of "Delivering". The below are the logs from adapter and Messaging system.
    File Adapter Log:
    Success   Message successfully received by messaging system. Profile: XI URL: http://xi-dev.intranet.XI.com.au:50200/MessagingSystem/receive/AFW/XI Credential (User): PIISUSER
    Success  Using connection File_http://sap.com/xi/XI/System. Trying to put the message into the receive queue.
    Success  Message successfully put into the queue.
    Success  The message was successfully retrieved from the receive queue.
    messaging system log:
    Message ID  44b756da-d9bd-42e2-3136-e34d75adfe03 
    Message Type  Asynchronously Received Message (RECEIVE) 
    From Service   Name:  BS_1  
    To Service   Name:  BS2  
    Action   Namespace  http://XI.com/SAP_PI/ControlData Name:  BYPASS  
    Connection Name   File_http://sap.com/xi/XI/System 
    Status   Delivering 
    Error Category    
    Error Code    
    Profile   XI 
    Transport   HTTP 
    Delivery Semantics   Exactly Once 
    Times Failed   0 
    Number of Retries   3 
    Sent / Received  09/09/2009 11:22:52 
    Transmitted / Delivered  09/09/2009 11:22:53 
    Next Delivery  09/09/2009 11:22:53 
    Persist Until  10/09/2009 11:22:52 
    Valid Until  01/01/1970 10:00:00 
    Retry Interval   5 Minutes 
    Address   http://xi-dev.intranet.XI.com.au:50200/MessagingSystem/receive/AFW/XI 
    Transport Headers   authorization=Basic UElJU1VTRVI6dDFhbTRyaWE= Content-Length=3010 accept-encoding=gzip sap-xi-messageid=44B756DAD9BD42E23136E34D75ADFE03 content-length=3024 host=xi-dev.intranet.XI.com.au:50200 user-agent=SAP Web Application Server (1.0;700) content-type=multipart/related;boundary=SAP_4AA4E14330050131E10080000A722149_END;type="text/xml";start="" HTTP=POST soapaction="http://sap.com/xi/XI/Message/30" 
    Principal Propagation

  • Steps for File Transfer through FTPS...!!!

    Hi ,
    Can anyone please tell the steps for file transfer with FTPS.
    Does PI file adapter has bulilt in feauture to handle this? or
    Do we need to deploy anything to handle this?
    Do we need to install any certificates by requesting from partner or It will do the encryptions/authentications on its own?
    Any additional Steps we need to mention in File receiver adapter while we send the file through FTPS?
    File is going through port 1090(unsecure connection) but it is not going through port (990) which is a secure connection.
    Please suggest me.
    Thanks
    Krupakar

    Hi Shabarish,
    We got the certificate from the partner and loaded into the trusted CA's. I tried running by giving
    Connectivity Security as "FTPS for Control and Data Connection" and Command Order as "AUTH TLS,USER,PASS,PBSZ,PROT"
    Ip: XXX.YY.YY.ZZZ
    Port: 990
    User and pwd.
    and I am getting the same below error
    Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error when getting an FTP connection from connection pool: com.sap.aii.af.service.util.concurrent.ResourcePoolException: Unable to create new pooled resource: iaik.security.ssl.SSLCertificateException: Peer certificate rejected by ChainVerifier
    I tried by selecting different options like
    1. Without selecting the X509 certificate for client authentication.
    2.  Keystore as TRUSTED\view\entry-cert
       X509 certificate and private key as TRUSTED\view\entry-cert
    3. Keystore as TRUSTED\view
      X509 certificate and private key as TRUSTED\entry-cert
    4.Keystore as "view"
      X509 certificate and private key as "entry-cert"
    Please help me in this.
    Thanks
    Krupakar

  • Windows 8.1 Pro - FTP.exe not able to put file to FTP Server

    Hi
    We have replaced our Windows XP environment to Windows 8.1 Pro. Now I have problem with sending files through FTP to very old devices. Devices are runninng FTP Servers. Each time I try to "PUT" file on Windows 8.1 I receive message after some time:
    "Connection closed by remote host"
    If I make the same on Windows XP file is stored on FTP successfully. 
    From Windows 8.1 I am able to upload software only via Filezilla, but I need command line solution like FTP.exe or ncFTP.exe (non of them are able to stor file)
    I have observed in Wireshark, that ftp.exe sends about 80kB of data, waits for some time and then it stops.
    Summary of my problem:
    Source Appl      
    Destination
      Status
    Win XP ftp.exe  
    FTP Server upload ok
    Win 8.1 ftp.exe  
    FTP Server upload failed
    Win 8.1 ncFTP.exe
    FTP Server upload failed
    Win 8.1 filezilla  
    FTP Server upload ok (but no command line solution)
    Win 8.1 environment:
    - standard installation of Windows 8.1 with newest Microsoft patches
    - firewall ports - opened for inbound and outbound traffic
    - no antivirus
    FTP Server on problematic devices:
    - old FTP Server, transfer in passive mode
    I need command line solution tu upload files. Now I am not able to upload 1500 devices as we don't have Windows XP anymore.
    What I have observed, when I type "PUT file" it takes about 20-30 seconds to start transfer on Windows XP or through filezilla.
    Is there any problem with timeout in Windows 8.1 when it transfer files to old FTP server (working in passive mode)?
    Thanks and regards,
    Marcin

    Hi Marcin,
    Here is a thread talking about Windows 8.1 and FTP, see:
    Windows 8.1 and FTP problems
    https://social.technet.microsoft.com/Forums/windows/en-US/db3793a6-2810-464c-af9a-522b05f51ba9/windows-81-and-ftp-problems?forum=w8itprogeneral
    Further, I am currently checking on the issue, if more things found out, I will update here.
    Thank you for your understanding.
    Best regards
    Michael Shao
    TechNet Community Support

  • Load files using ftp

    Hi,
    I�m trying to load a file through ftp using the folowing code:
    File file = new File("ftp//user:password@serever/directory/doc.txt");
    but it doesn?t work.
    Can you help me?
    Thanks.

    Here is the code I am using.
    import sun.net.ftp.*;
    FtpClient client = new FtpClient();
    client.openServer("Your IP Address");
    client.login("user", "password");
    InputStream inputStream = client.get("theFileName");
    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
    String line;
    do
    line = reader.readLine();
    } while (line != null);

Maybe you are looking for

  • SAP BEx Customer Exit

    Hi Gurus, I've implemented the code below for my report to display Required Start Date (MM/DD/YYYY) by searching and processing either a single Fiscal Year/Period (PPP/YYYY to PPP/YYYY) input or a range/interval Fiscal Year/Period (PPP/YYY) input. Th

  • Alert for orphaned files (.mdf, .ldf & .ndf)

    Hi,  Has anyone got any code that can scan all attached drives/directories for database files and compare them to what the instance says are attached files?  I have some code which works but you have specify the directories to monitor.   I know that

  • Adding a external display

    Is it possible to hook up a external monitor and close the powerbook and just use the external monitor? Thanks

  • Is it possible to create a list of NI-DAQmx tasks used in a VI in LV7.1?

    Hello, I was wondering if there is a built in function for Labview 7.1 that would allow me to generate a list of DAQmx tasks or global channels that are being used in the VI. Thanks, Steve

  • IPhone will not retain wrt54g password

    Hi all. I have  a iphone that will not retain the password for a WRT54g. Each time I leave the house, I have to renter the wifi password on my phone. It remembers other networks, just not the house. I'm clueless on modems, so if you suggest that I do