2014-12-07 3 views
0

내 이미지를 내 서버에 업로드하려고하는데이 이미지를 열려고 할 때 열 수 없습니다. 손상 되었기 때문에 열 수 없습니다. 누군가가 나를 도와 줄 수 있고 그 이유를 말해 줄 수 있습니까? 감사!
저는 Apache Commons Net jar를 사용하고 있습니다. 내 안티 바이러스가 차단 된Java 자바 FTP 업로드 파일이 손상된 이유

String hostName = "host"; 
String username = "username"; 
String password = "pass"; 
String location = "filePath.png"; 
FTPClient ftp = null; 

InputStream in = null; 
try { 
    ftp = new FTPClient(); 
    ftp.connect(hostName); 
    ftp.login(username, password); 

    ftp.changeWorkingDirectory("/pictures"); 

    int reply = ftp.getReplyCode(); 
    System.out.println("Received Reply from FTP Connection:" + reply); 

    if(FTPReply.isPositiveCompletion(reply)) 
    { 
     System.out.println("Connected Success"); 
    } 

    ftp.setFileType(FTP.BINARY_FILE_TYPE); 

    File f1 = new File(location); 
    in = new FileInputStream(f1); 

    ftp.storeFile("fileName.png",in); 

    System.out.println("SUCCESS"); 

    in.close(); 
    ftp.logout(); 
    ftp.disconnect(); 
} catch (Exception e) { 
    e.printStackTrace(); 
} 
+0

는 이미지를 적당한 크기인가? – EJP

+0

무엇을 의미합니까? 작은 이미지를 업로드하려고했지만 크기가 중요합니다. – Yael

+0

@ Yael 다음 번에 코드 조각을 게시 할 때 올바른 들여 쓰기와 [구문 강조] (https://stackoverflow.com/editing-help#syntax-highlighting)을 사용하십시오. – mezzodrinker

답변

관련 문제