How to Download an image from FTP using FTPClient?
<p>I m using this code and try to download an png pic from server .this is code</p>

<pre><code>import java.awt.image.BufferedImage;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.imageio.ImageIO;
import org.apache.commons.net.ftp.FTPClient;
public class NetTest {
  public static void main(String[] args){
    FTPClient client = new FTPClient( );
    OutputStream outStream;
    try {

      client.connect( "server" );
      client.login("noman@mindzone.co.in", "pass");

      String remoteFile = "Pages/page0001.png";
      outStream = new FileOutputStream( "C:\\asd.png" );
      client.retrieveFile(remoteFile, outStream);

    } catch(IOException ioe) {
      ioe.printStackTrace();
      System.out.println( "Error communicating with FTP server." );
    } finally {
      try {
        client.disconnect( );
      } catch (IOException e) {
        System.out.println( "Problem disconnecting from FTP server" );
      }
    }

  }
}
</code></pre>

<p>this code gives me no error but when i open the image it shows me invalid image .</p>
