Urgent : Help me Upload a file via FTP using URL

Hi
I am having a problem with an error (The system cannot find the file specified)
The files FTPPut.java and TESTING.txt are both in /src directory.
import java.net.*;
import java.io.*;
public class FTPPut {
     public static void main(String[] argv)throws Exception{
     int BUFFER = 1024;
     URL url = new URL("ftp://ftp.scit.wlv.ac.uk/pub/");
     File filetoupload = new File("TESTING");
     URLConnection urlc = url.openConnection();
     byte data[] = new byte[BUFFER];
     FileInputStream fis = new FileInputStream(filetoupload);
     BufferedInputStream bis = new BufferedInputStream(fis, BUFFER);
     OutputStream os = urlc.getOutputStream();
     int count;
     while ((count = bis.read(data, 0, BUFFER)) != -1) {
     os.write(data, 0, count);
     System.out.println("uploaded sucessfully...");
     bis.close();
     os.close();
Exception in thread "main" java.io.FileNotFoundException: TESTING (The system cannot find the file specified)
     at java.io.FileInputStream.open(Native Method)
     at java.io.FileInputStream.<init>(FileInputStream.java:106)
     at FTPPut.main(FTPPut.java:11)
Edited by: AceV on Jan 10, 2008 7:28 AM

import java.net.*;
import java.io.*;
public class FTPPut {
     public static void main(String[] argv)throws Exception{
     int BUFFER = 1024;
     URL url = new URL("ftp://ftp.scit.wlv.ac.uk/pub/");
     File filetoupload = new File("TESTING");
     URLConnection urlc = url.openConnection();
     byte data[] = new byte[BUFFER];
     FileInputStream fis = new FileInputStream(filetoupload);
     BufferedInputStream bis = new BufferedInputStream(fis, BUFFER);
     OutputStream os = urlc.getOutputStream();
     int count;
     while ((count = bis.read(data, 0, BUFFER)) != -1) {
     os.write(data, 0, count);
     System.out.println("uploaded sucessfully...");
     bis.close();
     os.close();
}

Similar Messages

  • PI needs to obtain a zip file via FTP using the File adapter

    I have a scenario where PI needs to obtain a zip file via FTP using the File adapter, this zip file contains a number of txt files that I need to process, and the content of one of them send it to an ECC, now I'm using the PayloadZipBean Module in the Sender FIle Adapter, and I have two things if I use the Message Protocol as File, I get a Payload for each txt file in the zip file, but this payload has no structure, and if I use the File Content Conversion I get an XML strcuture with only one field and a strange string in it, and somewhere in this string the names of the files I assume all the content of the zip file, can anyone help on how could I achieve what I need that is to pull the zip file via SAP PI, then unzip it, and with the content of one of the txt files send it to an ECC via ABAP Proxy, thanks in advance for your answers.
    Regards,
    Raul Alvarado

    Hello Raul,
    you can do it in futher way ...
    pickup zip file and simply extract and dump it in another temp folder (can use scripts on OS level).
    @ then Use another sender communication channel to pickup all these text file .
    for further clarification you can use these links also. -
    Process txt files in zip file
    Accessing File using FTP from Java Mapping
    File Sender Adapter with FTP protocol
    BR
    Raj

  • Problems uploading big files via FTP and downloading files

    I've been having problems uploading big files like video files (.mov 12MB) via FTP to my website (small files like .html or .doc I can upload but it takes longer than usual). I'm using Fetch 4.0.3. as FTP. Same problems when downloading files via Bit Torrent. I recently moved to Spain, since then I seem to have the problem. But my roommate with a PC doesn't have that problem. Connecting to internet with Ethernet cable also didn't resolve the problem. I also tested it from a Starbucks coffee connecting to Internet from there but still couldn't upload that 12MB file to the FTP. The security settings for firewall are set to "allow all incoming connections". I didn't change any of my settings so I don't know what the problems could be. I have a MacBook Pro, Mac OS X (10.5.7) Any suggestions? Thanks!

    Welcome to Apple Discussions!
    Much of what is available on Bittorrent is not legal, beta, or improperly labelled versions. If you want public domain software, see my FAQ*:
    http://www.macmaps.com/macosxnative.html#NATIVE
    for search engines of legitimate public domain sites.
    http://www.rbrowser.com/ has a light mode that supports binary without SSH security.
    http://rsug.itd.umich.edu/software/fugu/ has ssh secure FTP.
    Both I find are quick and a lot more reliable than Fetch. I know Fetch used to be the staple FTP program, but it grew too big for my use.
    - * Links to my pages may give me compensation.

  • Problem on upload file via ftp..

    Hi afternnon,
    Can have people tell me.....what is "Can't open data connection" on my upload file via ftp ????how to solve it??
    regards,
    mike

    nbelford wrote:
    I cant find any way to upload the CSR either/ I dont think it exists yet. Can someone please let us know how far away it is. Same applies to the provisioning profile. I cant see any evidence of this yet either.
    I am presuming that without these key pieces of the puzzle one cannot deploy to the iPhone. Can someone from Apple confirm (or correct me)
    I've emailed Apple asking for clarification but I haven't heard back yet. I imagine we'll all learn what's going on at about the same time. And yes, until you get a certificate you cannot upload your apps to the iPhone (within the SDK rules).
    Randy

  • Upload XL file from FTP server

    Hi All,
    Can anybady help me, how to upload Excel file from FTP server.
    Thanks
    Sri
    Edited by: srikanthn on Apr 14, 2010 6:31 PM

    Hello
    How about using SAPFTP?
    I hope SAP note 130106 will guide you on this.
    Thanks
    koju

  • Sender File Adapter  not able to get file via FTP from an external system

    Hi,
    I have a Sender File Adapter using FTP which polls a server every 10 seconds looking for a file ".xml".  The adapter will connect and pick up the waiting file, but sometimes the adapter not able to get file via FTP from an external system. The file is on the server, but despite the polling, the adapter does not pick up it. There is no return error.
    The connect mode is Permanently and the transfer mode is Binary.
    Can you help me?
    Thanks.
    T.

    Hi Teresa,
    does this case appears with a file size higher the others?
    Personally, I do not recommend to have a polling under 1min.
    10s could be too just, if the file is not small and/or if the file server is far (several kilometers) to where the Adapter Engine is, and/or this file server is beside a firewall. Do not forget also that, with previous points, you could have like a conflict, betwen the 1st polling and the 2nd polling, if in less 10s PI adapter has not enough time: to connect to the FTP server (several Km), find the file (perhaps among 100 other files in the directory), go back to the file to Adapter Engine server (several Km again), convert your file to XML message (with a complex Content Conversion), then check the XML structure, and when all that is done, return back to FTP server (several Km), to archive the source file... Well It's my understanding of a FTP exchange with FILE adapter...
    If you really need a 10s polling, that's mean your have a pseudo real time interface. In that case, in my mind file should not be used! but we should use a Web service, JDBC JMS (any exchange without a physical object like a file). For me, it's a non-sens to have a file in that case.
    regards.
    mickael

  • 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!

  • When i upload my site via ftp to 3rd party hosting i only get 'index of/' when looking at the webpag

    I have exported my site and even tested on adobe and everything looks ok.  For some reason when I export and uplaod via ftp to my 3rd party hosting and look at the site I just get the index of/  and a list of the pages and directories underneath

    Thanks for that.  Now sorted.  It was a problem on my hosting
    Ian
    cid:[email protected]
    cid:[email protected]<http://twitter.com/dieselthefrog>[cid:[email protected]][cid:[email protected]]<http://www.facebook.com/dieselfrog>[cid:[email protected]][cid:[email protected]]<http://uk.linkedin.com/pub/ian-royle/30/a20/928>
    From: Abhishek Maurya [email protected]
    Sent: 04 July 2012 23:02
    To: Ian
    Subject: when i upload my site via ftp to 3rd party hosting i only get 'index of/' when looking at the webpag
    Re: when i upload my site via ftp to 3rd party hosting i only get 'index of/' when looking at the webpag
    created by Abhishek Maurya<http://forums.adobe.com/people/Abhishek+Maurya> in Help with using Adobe Muse - View the full discussion<http://forums.adobe.com/message/4538835#4538835

  • Unable to upload video files via iframe in safari version 3.0

    I m not able 2 upload video files via iframe in safari 3.0.
    i m facing this issue when i try 2 upload a video file via an iframe.
    file gets uploaded properly if i m not using iframe to upload the same.
    this issue is seen only in safari version 3.0 and not in the newer version i.e (3.2.1)
    do anyone has the asnwer for this problem.....???
    would be thankful to him/her...

    Are you using a BT Home Hub with the IP Phone attached. This holds onto the SIP port that iChat uses. There is no way to get the router to release this port.
    I had to return it all to BT as unfit for purpose and switched to Eclipse!

  • How to upload Excel file in BI using function module in abap program

    How to upload Excel file in BI using function module in abap program?

    Hi Anuj,
    To upload the file , you can try a standard program "RSEPSFTP" .
    while you execute the program , a selection screen appears in which the inputs should be give as
    RFC destination - The target server name
    FTP command- PUT
    local file - your file name
    local directory - path of your local file
    remote file - your target file name
    remote directory - where it has to be stored
    Hope this is useful for you
    Thanks & regards
    Anju

  • Uploading a file to server using servlet (Without using Jakarta Commons)

    Hi,
    I was trying to upload a file to server using servlet, but i need to do that without the help of anyother API packages like Jakarta Commons Upload. If any class for retrieval is necessary, how can i write my own code to upload from client machine?.
    From
    Velu

    <p>Why put such a restriction on the solution? Whats wrong about using that library?
    The uploading bit is easy - you put a <input type="file"> component on the form, and set it to be method="post" and enctype="multipart/form-data"
    Reading the input stream at the other end - thats harder - which is why they wrote a library for it. </p>
    why i gave the restriction is that, i have a question that <code>'can't we implement the same upload'</code>
    I was with the view that the same can be implemented by our own code right?

  • How to upload a file into server using j2ee jsp and servlet with bean?

    How to upload a file into server using j2ee jsp and servlet with bean? Please give me the reference or url about how to do that. If related to struts is more suitable.
    Anyone help me please!

    u don't need j2ee and struts to do file uploading. An example is as such
    in JSP. u use the <input> file tag like
    <input type="file"....>You need a bean to capture the file contents like
    class FileUploadObj {
        private FormFile srcFile;
        private byte[] fileContent;
        // all the getter and setter methods
    }Then in the servlet, you process the file for uploading
        * The following loads the uploaded binary data into a byte Array.
        FileUploadObj form = new FileUploadObj();
        byte[] byteArr = null;
        if (form.signFile != null) {
            int filesize = form.srcFile.getFileSize();
            byteArr = new byte[filesize];
            ByteArrayInputStream bytein = new ByteArrayInputStream (form.srcFile.getFileData());
            bytein.read(byteArr);
            bytein.close();
            form.setFileContent(byteArr);
        // Write file content using Writer class into the destination file in the server.
        ...

  • How to get the owner name for the file in ftp using abap ?

    Hi folks ,
    How to get the owner name for the file in ftp using abap ? please help me very ugernt . I tried with all standard FTP commands
    but doest work out me . Helping in this regard highly appreciated ...
    Thanks and regards,
    Swarupa Vanarchi

    Hi
    dont you  have used the os user while calling the FTP_CONNECT FM?
    Hope you are not talking about the user executing the FTP program.
    Else If you are talking about the FTP file creator then its not related to abap as you can handle it by maintaining the user in file name itself.
    May be i am going too far with if and elses here as your question possesses no  clarity.
    Plz elaborate your requirement  before anybody can help.
    Regards
    sateesh

  • Uploading a file in KM using KM API

    Hi,
    How to upload a file into KM using KM API.
    Regards
    MQ

    Hi,
    Pls go thru the below code.
    public static final String uptoKm(com.sap.tc.webdynpro.services.sal.datatransport.api.IWDResource resource){
                               try {
                                       ResourceContext  contex= new   ResourceContext(WPUMFactory.getUserFactory( ).getEP5User(req.getUser( )); );
                                       IResourceFactory factory = ResourceFactory.getInstance();
                                         RID rid = RID.getRID(PATH);
                                          ICollection folder = (ICollection)factory.getResource(rid,contex);
                                           Content content = new Content(resource.read(true),"byte",-1);
                                         folder.createResource(resource.getResourceName(),null,content);
                                       return resource.getResourceName();
                                  } catch (NotSupportedException e) {
                                       e.printStackTrace();
                                  } catch (AccessDeniedException e) {
                                       e.printStackTrace();
                                  } catch (ResourceException e) {
                                   e.printStackTrace();
                                   return null;
                                  } catch (IOException e) {
                                       e.printStackTrace();
                 return null;
    Above method accept parameter of resource and return file name on sucessfully uploaded.
    best regards
    Hari.

  • How to avoid partial files via FTP from XI to an external server?

    Hi all,
    I'm working in an interface where XI sends a big file (greater than 1MB) via FTP to the client. The client needs an empty file to be created once the file has been fully sent from XI, with format <b>.ok</b>, so that their server can trigger their interface to process the file.
    They want this procedure to ensure no partial files are processed.
    Could someone please help me out on how to do this in XI.
    Thank you.
    <b>Juan Carlos</b>

    HI rajendra
    look into this
    file.checkFileModificationInterval=<msecs>
    Use this parameter to define a length of time (default value: 0) for the file/FTP adapter to wait after the file has been read to see if the file length changes. If this is the case, the system repeats the read procedure. This is useful if the files to be imported by the adapter are generated dynamically without being locked on the operating system level (for example, files received from FTP servers). Without this workaround, the file/FTP adapter cannot recognize whether the generation of the file is complete in such applications with operating system functions.
    regadrs
    nisar

Maybe you are looking for

  • Printer selection to print Z report

    I have one classical report, At selection screen I want to have two Radio Button. Based on redia Button selection report should print to A3 or A4 page. What printer setting I need to do, what coding need to be done. Please reply

  • How to change subjects in Mail?

    Dear all, after upgrading to 10.5, I gave up with Eudora as the performance was getting to slow and moved to Mail. But now I miss one function: How can I change the subject of a received mail? I'm used to change the subject in received mails to show

  • Trying to fix my ENVY-7227cl where the hard drive is failing

    So my refurbished ENVY-7227cl hard drive is failing after a whopping 4 months and I can barely get it to boot to windows 8 and within minutes it freezes and crashes. I ran the hard drive check on the boot menu and it gave a failure code. I'd like to

  • Problem PS-Elements 6 & 7

    Das Umschalten vom Voll-Editor zum Schnell-Editor dauert 10 Sek. (Desktop Computer neuester Generation). Beim Notebook dauert es nur 2 Sek. Was muss ich verändern, um diese lästige Wartezeit zu verkürzen? Danke im Voraus. Wolfgang Kieckbusch

  • Direct certification _SAP Basis administration (TADM51_70)

    Hi, I would like to take up the SAP certified technology associate (ie., TADM51_70) cerfication in singapore and currently i having 8 exp.in IT and having a good exposure and oriented knowledge in SAP Basis environment. Kindly suggest if any direct c