0 0

org.apache.commons.net.ftp.FTPClient上传照片问题3


FTPClient client = FtpUtil.CONNECT(site.getHost(), site.getUserName(), site.getPassword(), site.getPort());
//        client.enterLocalPassiveMode();
        try {
            client.setFileType(client.BINARY_FILE_TYPE);
        } catch (IOException ex6) {
        }
//        client.setControlEncoding("GB2312");
//        client.setRemoteVerificationEnabled(true);
        InputStream is = null;
        OutputStream os = null;
        try {
            is = new FileInputStream(localFile);
        } catch (FileNotFoundException ex) {
        }
        try {
            os = client.storeFileStream(FtpUtil.strToIso(remotePath));
        } catch (IOException ex1) {
        }
        byte[] buffer = new byte[4096];
        int bytes = 0;
        try {
            int i = 0;
            while (((bytes = is.read(buffer)) != -1)) {
                os.write(buffer, 0, bytes);
                i += bytes;
            } //end while
        } catch (IOException ex5) {
        }
        try {
            os.close();
        } catch (IOException ex3) {
        }
        try {
            is.close();
        } catch (IOException ex4) {
        }
        FtpUtil.DISCONNECT(client);



以上是我写的代码。上传照片的底边缘缺像素,为什么,如何才能上传完好无损。
2011年7月09日 10:41
目前还没有答案

相关推荐

Global site tag (gtag.js) - Google Analytics