FTP problem:  why do my uploaded files contain nothing?

Hi,
I'm using the sun.net.ftp package
In my servlet I have,
public void doGet(HttpServletRequest req, HttpServletResponse resp)
          throws ServletException, IOException {
          PrintWriter out = resp.getWriter();
          out.println("Attempting to connect to www.ttc.ca<br><br>");
          FtpClient client = new FtpClient(host, 21);
          try
               client.openServer(host);
               client.login(uid, pwd);                    
               client.cd("public/postings/dev");          
               client.binary();               
               TelnetOutputStream fos;
               fos = client.put("myupload.txt");
               out.println(client.getResponseString() + "<br><br>");
               int i =0;
               FileInputStream fis = new FileInputStream("//station/xxxx/personaldirectory/desktop/blah.txt");
               while (( i = fis.read()) != -1 )
                    fos.write((byte) i);
                    out.println((char) i);
               out.println("<br><br>" + client.getResponseString() + "<br>");
               out.println(fos.toString());
               fis.close();
               fos.close();
               out.println("<br><br><br>");
               client.closeServer();
          catch (FtpLoginException ex)
               out.println("failure");
So right now what it does is make the file myupload.txt onto the server and leaves it blank. However, the size of the file matches the size of the file I read from. Why is the uploaded file showing up with no content and how can I remedy this?
Thanks
          

Never mind I got it to work for txt files only
FtpClient client = new FtpClient();
client.openServer(host);
I used a blank constructer instead of puting the host and port # in there

Similar Messages

  • Uploading files containing swedish letter åäö gets ecoding corrupted in firefox for mac. Same features works fine in all other browsers. Is this a bug in firefox for mac?

    When uploading a file containing swedish letter å, ä or ö the file name is gets corupted in the filename. There are som encoding issues just for the mac version, since the file name is uploaded correctly in all other browsers on mac and all browsers in windows.

    What form does this corruption take? According to https://bugzilla.mozilla.org/show_bug.cgi?id=695995 the difference is decomposed vs precomposed Unicode forms, but that should not actually affect any Unicode-complian software. If there's a site that shows a problem here, can you point me to it?

  • How to upload file containing Japanese characters in AL11

    Hi All,
    I'm trying to modify a program that extracts a text file from local drive then upload the file to sap directory. The input text file contains Japanese characters. When I view the file created, it looks like the one below:
    #º#®#~#^#ì#q  ¼ÓÔ¼·Ï·º
    #ì#ç#ß#q  ÐÅÐÁÂÞº
    The code that I am fixing is below:
       open dataset pv_name for output in text mode encoding non-unicode
       ignoring conversion errors.
    open dataset pv_name for output in legacy text mode code page '8000' ignoring conversion errors.
    *OPEN DATASET pv_name FOR OUTPUT IN TEXT MODE ENCODING UTF-8 WITH BYTE-ORDER MARK.
        if sy-subrc = 0.
        LOOP AT pt_input.
          TRANSFER pt_input TO pv_name.
          IF SY-SUBRC NE 0.
            WRITE:/ 'Error writing file'(011), pv_name.
            STOP.
          ENDIF.
        ENDLOOP.
       endif.
      Close dataset
        CLOSE DATASET pv_name.
    Any suggestions on how to resolve this one?
    Thanks a lot in advance.

    I didnt said that this will resolve your errors. But using this is the same of ignoring comiler errors....
    As you didnt said anything about codepages you're using no help is possible, you didnt mentioned if your SAP system is Unicode, Non-Unicode or even a MDMP system.
    You need to figure out which codepage the file has on the presentation server and which codepage your SAP system is using. And it can be that no conversion is possible cause both systems do not have any character in common.

  • Why does my upload file window close unexpectedly?

    Whenever I try to upload a file to facebook or my website the window closes as soon as I open it... It takes 3 or 4 tries before the window will stay open long enough to find the file and click open.

    '''[https://support.mozilla.org/en-US/kb/reset-firefox-easily-fix-most-problems Reset Firefox]''' {web link} is a '''LAST RESORT ! !'''
    Reset Firefox -- easily fix most problems
    If you're having problems with Firefox, resetting it can help. The reset
    feature fixes many issues by restoring Firefox to its factory default state
    while saving your essential information like bookmarks and open tabs.
    But first load and use these add-ons.
    These add-ons can be a great help by backing up and restoring Firefox
    '''[https://addons.mozilla.org/en-US/firefox/addon/febe/ FEBE (Firefox Environment Backup Extension)]''' {web link}
    FEBE allows you to quickly and easily backup your
    Firefox extensions, history, passwords, and more.
    In fact, it goes beyond just backing up -- It will actually rebuild
    your saved files individually into installable .xpi files.
    It will also make backup of files that you choose.
    '''[https://addons.mozilla.org/en-US/firefox/addon/opie/ OPIE]''' {web link}
    Import/Export extension preferences

  • Why cant i upload files after upgrading to mountain lion?

    i just upgraded to mountain lion and now when i try to select files to upload using safari it will not let me select them.is this a common fault?how do i remedy this?

    You probably have some incompatible software.
    I wrote a little diagnostic program to help show what might be causing these problems. Download EtreCheck from http://www.etresoft.com/download/EtreCheck.zip, run it, and paste the results here.
    Disclaimer: Although EtreCheck is free, there are other links on my site that could give me some form of compensation, financial or otherwise.

  • Problem with the # in upload file of application server.

    Hi All,
    I have a to upload a unix file which have # after every field.
    i tried  " OPEN DATASET x_file FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS."
    but its  not working
    .would appreciate if you can  reply to this  on immediate basis.
    Thanks in advance

    Chiru,
    You should be ok with somethign like this as long as the # is a true delimiter and not part of the data.
    FORM retrieve_file.
      data: wk_rec(30000)     TYPE c.
      CLEAR t_error.
      OPEN DATASET zfile IN TEXT MODE MESSAGE t_mesg.
      IF sy-subrc NE 0.
        MOVE 'X' TO t_error.
        MESSAGE e100(z0) WITH 'Error opening file:' t_mesg.
        EXIT.
      ENDIF.
      DO.
        READ DATASET zfile INTO wk_rec.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
        SPLIT wk_rec AT '#'      " <== your delimter
          INTO  in_rec-field1
                in_rec-field2
                in_rec-field3
                in_rec-field4
                in_rec-field5.
        APPEND in_rec TO it_input.
      ENDDO.
      CLOSE DATASET zfile.
    Edited by: Paul Chapman on Apr 14, 2008 3:27 PM

  • Why does placed eps file containing a drop shadow lose transparent background?

    When I place an eps file from adobe illustrator cs6, which has a drop shadow, into InDesign the file loses its transparent background and comes in with a solid white background. I'v selected the "Transparent" radial button in Illustrator while saving the file to eps but it doesn't work. Any ideas???

    EPS means Encapsulated PostScript (it's really PostScript code wrapped up in a capsule that allows you to place it into other applications as an image), and the PostScript specification doesn't include transparency. That's why even though you have transparency in the Illustrator image, it's format won't translate that transparency data into usable transparency when you place it into InDesign. Lack of transparency support is one of the main reasons people recommend not using eps in a modern workflow.

  • Why do converted pdf files contain numerous errors?

    When I convert a pdf to word there are many errors in the worrd document.   When I save the document to my document library it dissapears.  Whats up?

    Hi there,
    I'm having the same problem, started only recently. Did you find a reason/solution?
    I've tried Windows 7 and Windows XP, no difference. IE and FF open on page 2, but Chrome opens on page 1, as it should.
    Googling around I found people having similar problems after updating to new version of AIR and Acrobat Reader, so it might be a bug/incompatibility introduced by those updates.
    My best guess is that it has to do with the reading order being improperly generated by the PDF library (FPDF in my case).
    Thanks for reading!
    Marc

  • Adobe Acrobat Standard XI: Why prompted to save file when nothing changed?

    I have Adobe Acrobat Standard as the default PDF reader. I PDF printed a page from a website. Then I clicked to open the PDF. After I finished viewing the file, I closed the window. Adobe Acrobat prompts me to save: Yes, No, Cancel. Since I changed absolutly nothing, I am puzzled why Adobe Acrobat's save dialog thinks there are changes and askes me whether I want to save the changes.
    I have repeated opening and closing the PDFseveral times.
    Then, I tried opening and closing another PDF, and it just closes without prompting to save.
    Why do I get different behaviors on different PDFs? And can I control the behavior to get or not get the save prompt when there are no changes?

    I like that Adobe Acrobat will correct problems, then ask you whether to save.
    In the case of this file, I click Yes to save. Then the next time I open and close the file, it asks again, and I click Yes to save. Adobe Acrobat always does it with this file.
    With another file, Adobe Acrobat (AA) does not prompt, unless I change the file.
    I don't know which difference matters. AA created both PDFs. The problem file was a print from a webpage. The good file (that closes without prompting) was created from a scanner.
    I tried PDF printing this page (i.e. the page on which I am composing my response to your message). Then, I opened and closed the PDF, and was prompted to save.
    Seems like if AA corrected the problem, and I saved, AA should not have to correct the problem again (if that is what's happening). Also, if AA made the PDF in the first place, there should be no problems with the PDFto correct.
    You know what? I just tried printing another website and same prompting everytime I close.
    I've been using Chrome. I tried printing with Internet Explorer, and no problem of prompting when closing.
    Hmm. I just tried PDF printing from FireFox. No problem here either.
    Well, Now I suppose I just leave it for Google and Adobe to work out, if they care to.
    I just tried opening the problem file in AA and PDF printing from it. This seems to have cleaned the file. The second PDF file has no problem opening and closing.
    I've got an idea. I just went to the address bar in Chrome and typed "Chrome://plugins". That's the only way I know to get to the Chrome plugins. I saw that I have BOTH the Chrome built-in PDF Reader  AND the Adobe Create plugins enabled. I disabled the Chrome PDF Reader so ONLY the Adobe Create plugin is enabled.
    I printed this webpage again (the webpage you are reading). This time, there was no problem opening and closing the PDF, no prompts to save.
    However, now online PDFs will not display in Chrome. Instead, Chrome offers to download the PDF.
    I went back to the plugins and found Adobe Reader disabled. I enabled Adobe Reader so now I have both Adobe Reader and Adobe Create plugins enabled.
    The problem came back.
    I don't know who would fix this, Adobe or Chrome, but would be nice to "have my cake and eat it, too" meaning, not have to muck with the plugins to AA-print clean PDFs from Chrome, and then muck again with the plugins to display PDFs in Chrome.
    I tried FireFox. Displays PDFs, and AA-prints PDFs that are clean (i.e. no prompt on closing from AA).
    Well, that is enough (maybe more than enough) from me on this. I'll monitor this discussion in case anyone comments.

  • Why does my .jar file do nothing when double clicked?

    Hi all. Just got into java, though I do have a background in Visual Basic, PHP, C / C++ and JavaScript. Anyway, i've written a "Hello World" program and it runs successfully in the IDE, however when I run the .jar executeable file, nothing happens. Why? Thanks in advance.

    I'm using NetBeans IDE, and I have everything set up correctly to the best of my knowledge. As said, no problems arise when running the application in the IDE, just running the .jar file directly is giving me problems. Here is the code if it provides any assistance in solving my problem:
    package including;
    * @author jayz
    import java.io.*;
    // #include <java.io.h>
    public class Main
        //in Java, everything is encapsulated in2 classes, not functions
        public Main()
        //creates a Main() object
        public static void main(String[] args)
            System.out.println("Hi");
        //is our main function (method)
    }

  • MULTIPLE UPLOAD file problem

    Hello,
    I have a problem with multiple upload file tool.
    Because my server need, in order to upload files in its folders, to be logged only with ftp user (that is unique).
    Now, I need that when I upload a file its name will be stored on db table "file_name". But in order to put data in database i have tobe logged also with user that is allowed to access on mysql db.
    So I understand that I should nedd to types of authentication at the same time...
    I think it depends on my type of hosting that is windows, and there is not the possibility to change CHMOD, so the error when I try to upload a file is that the folder has not write permissions...
    Any suggestions?
    Thanks a lot
    ascaro231
    Italy

    Hi ascaro231,
    wow, that is one bag of problems on the remote side :-(
    to be logged only with ftp user
    although PHP itself provides native FTP functions
    (e.g. for uploading files and also changing folder & file permissions), ADDT´s file upload features don´t support this protocol
    and there is not the possibility to change CHMOD
    CHMOD *will* have to be supported by your host, because this is how ADDT changes folder & file permissions.
    Well, to me it seems that your host doesn´t provide some very basic and truly common-standard PHP settings -- and honestly, disabling the regular PHP file upload features is ridiculous.
    Any suggestions?
    go for a better host -- this is just inacceptable.
    Are you hosting with "Aruba" BTW ? They have both Windows and Linux hostings, and AFAIK it´s possible to switch the hosting type.
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Uploaded File Processing

    Hello,
    I have been searching all day for a reasonable solution to my problem and have found many answers but I am not sure which is the best way. Here is my problem:
    I have a web app that allows a user to upload a csv, I do some validation on the file then write the file to disk. I process the file and when finished email the user a csv file.
    What I would like is to have the user upload the file and be done until they receive their email. How would I start processing the file without the user waiting for the processing to finish.
    Some files could take upwards of 40 minutes to process, so you can see why I don't want the user to wait for the results.
    I have tossed around the idea of starting new threads, backgrounds processes I am just not sure what the best way to do it is.
    I would appreciate thoughts from people who have done this themselves or have knowledge about the process.
    Thanks

    hfalaska wrote:
    I think I understand what you are saying, one thread that will process multiple files one at a time. I was thinking having maybe two or three threads running so in case an uploaded file contains a large amount of data to process(which will take time to process) I would have other threads able to process other files. This would keep the wait time down on users receiving their data.Understand that this is a trade-off. Multiple threads can potentially be less efficient, and for most tasks, a single thread running the tasks in sequence has greater throughput.
    You should also consider how CPU-intensive the process is in comparison the upload speed. If the server can keep up processing the files at the rate they are uploaded, then you're better off processing as the file is uploaded.
    I am stumped about one other thing, I have created my thread pool with three workers, I have my queue and am adding a file to the queue. But what has me scratching my head is I need to pass some parameters to the processing class and I am not sure how to do that. Any ideas?Create a Request object containing all the relevant data. If you're using a single thread with a queue, submit the Request objects to the queue. If you're using a pool of threads, make your Request object Runnable, or instantiate your Runnable with the given Request object and then pass the Runnable to the executor.

  • Uploading files in UCCX 8.0

    Hi,
         I'm trying to write a script based on the emergency evacuation script in the repository. I've found out all of the nasty "you should never use this way" things in the script and changed them so that the write file is now an auth user and upload file step. The problem is that the upload file step always hits the fail branch and I can't figure out why. I've tried deleting the original file (although it is set to overwrite) and that makes no difference and I'm authenticating as the same admin as uploaded the files in the first place. I'd appreciate any pointers.
    Thanks,
         Joe

    Rui,
    I've come across lot of such requests from Cisco partners & customers but as far as I know, automation of entire process is not possible as of yet. The call list needs to be manually imported to outbound campaigns by Admin, this can not be automated.
    Would love to hear some great ideas on this topic from great folks here.
    Pls rate the post if it helps.
    GP.

  • FI Upload file (Approval Workflow)

    Hi All,
    Need some assistance:
    Currently our company has a standard approval workflow built.  So when we receive an invoice without a PO, we manually post the invoice to a GL & Cost Centre.  Once the invoice is coded, It’s then sent to the GL owners to approve using the workflow currently in place.  All this works perfectly fine.
    My issue is FI Upload files……. As Upload files contain several GL accounts – we are currently attaching a manual email approval from the approver to the file upload so the Accounts Payable department could post without any further approvals in Workflow as an email approval is sufficient.
    We would like to build the same workflow approval cycle that we have already in place for Fi Invoices.
    Note – an upload file come in with 10 different GL accounts ( ideally we don’t want to send it to 10 different approvers) as this will slow down the process, so I was wondering if there is a better solution that you could share to eliminate the upload going to 10 approvers.
    Any Suggestions are greatly appreciated.
    Thanks
    Alex

    Hi All,
    Need some assistance:
    Currently our company has a standard approval workflow built.  So when we receive an invoice without a PO, we manually post the invoice to a GL & Cost Centre.  Once the invoice is coded, It’s then sent to the GL owners to approve using the workflow currently in place.  All this works perfectly fine.
    My issue is FI Upload files……. As Upload files contain several GL accounts – we are currently attaching a manual email approval from the approver to the file upload so the Accounts Payable department could post without any further approvals in Workflow as an email approval is sufficient.
    We would like to build the same workflow approval cycle that we have already in place for Fi Invoices.
    Note – an upload file come in with 10 different GL accounts ( ideally we don’t want to send it to 10 different approvers) as this will slow down the process, so I was wondering if there is a better solution that you could share to eliminate the upload going to 10 approvers.
    Any Suggestions are greatly appreciated.
    Thanks
    Alex

  • How to upload files residing in a folder on local file system .

    Hi, I have a problem when trying to upload files.
    I have a folder in my local system and have n files in it. Now if i use the file upload element i need to click n times to upload these files. So i want to achieve programatically to upload all the files in a folder given the folder name to the application. Is this possible or is there any restriction to achieve this through webdynpro.
    Also how to know programatically all the names of files and folders in a particular folder during web dynpro session.
    Regards,
    Vinay.

    Hi Vinayaka,
    Watch these links..
    Uploading multiple files using the FileUpload UI element
    Files...
    Regards,
    Karthick K Eswaran
    Display files in web browser

Maybe you are looking for

  • Default Header text comes in PO at the time of creation

    Hi Friends,                my problem is that a default Header text must come on the PO based on the user or purchasing group at the time Creation (In Transaction ME21N). Is there any user exits or badi for it. I have already searched for them but i

  • Having trouble with transfering music in Vista

    Never had any of these issues in XP. At first, I thought it had to do with Anapod but I'm experiencing the same on Itunes... 1. The player will disconnect/reconnect in mid transfer slowing down the transfer 2. If I send more than just a couple of fil

  • Images in Finder but not in iPhoto

    Just restored using Backup 3.1.2. Most pics & Events appear in iPhoto '08. However, most current pics (March to August) do not. I can see the pics using "Show Package Contents" of Picture/iPhoto Library/Data -OR- Picture/iPhoto Library/Originals If I

  • How to copy a line in Oracle Forms

    Hi Experts, We have a custom form, where there is a tabbed canvas under which few context canvases are there. Some fileds are there in each context canvas under the tab canvas. my requirement is to copy the line to a new line, so that all values in e

  • DM Export Base Member Selection -- Need to Use a Filter

    Hi Experts, Posting a follow-up on this one.  Does anyone know how to run the Data Manager Export package when producing a (relatively) large data set? The challenge is that when running an Export, you'd want to chose all base-level members in some d