Results 1 to 6 of 6
  1. #1
    dudejonne is offline Member
    Join Date
    Oct 2009
    Posts
    56
    Rep Power
    0

    Exclamation Empty FileInputStream..

    File file = new File("image1.jpg");
    FileInputStream fin = new FileInputStream(file);
    FTPClient client = new FTPClient();
    String filename = "image.jpg";
    client.storeFile(filename, fin);
    fin.close();

    I use that code to store an image to my server. It works an image gets saved as image.jpg. The width and the heigth of the image are equal to those of the bufferedimage, but the whole image is just transparent. There are no colors in it.

    There is also nothing wrong with the BufferedImage, because the image1.jpg (which gets stored in my own folder) is normal, and looks like it should be.

  2. #2
    Menre is offline Member
    Join Date
    Feb 2008
    Posts
    79
    Rep Power
    0

    Default

    Then, what is your question or have I misunderstood you?

  3. #3
    dudejonne is offline Member
    Join Date
    Oct 2009
    Posts
    56
    Rep Power
    0

    Default

    2shared - download image.jpg

    There you can download the image, it is very weird that is doesn's works. If I try it like this for example:

    File file = new File("lolz.jpg");
    ImageIO.write(bimg, "jpg", file);
    FileInputStream fin = new FileInputStream(file);
    String filename = "image.jpg";
    client.storeFile(filename, fin);

    Then the image uploaded to my server is totally transparent. The lolz.jpg that is stored on my pc is normal. Also when you download the image that was originally stored on my server and you try to open it with any program you will see it won't open it. Also the one on the server is around 200 bytes smaller then the one stored on my pc..

  4. #4
    dudejonne is offline Member
    Join Date
    Oct 2009
    Posts
    56
    Rep Power
    0

    Default

    Could someone please look into this?
    Because the whole ftp thing finally works, this is the only problem left.

  5. #5
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,648
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by dudejonne View Post
    Could someone please look into this?
    Because the whole ftp thing finally works, this is the only problem left.
    Maybe you have to set the data transfer to 'binary'; check the API documentation.

    kind regards,

    Jos

  6. #6
    dudejonne is offline Member
    Join Date
    Oct 2009
    Posts
    56
    Rep Power
    0

Similar Threads

  1. Replies: 5
    Last Post: 02-02-2010, 09:06 AM
  2. Replies: 13
    Last Post: 09-16-2009, 01:05 PM
  3. [SOLVED] Access Denied error using FileInputStream
    By xcallmejudasx in forum New To Java
    Replies: 8
    Last Post: 05-21-2009, 04:13 AM
  4. Replies: 0
    Last Post: 12-01-2008, 09:50 PM
  5. Replies: 1
    Last Post: 08-03-2007, 06:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •