private static void envioArchivoFTP2() {
String pass = "00.000.00.000";//url
String localPath = "C:/Colores .png";
String remotePath = "/Colores.png";
String user = "anonymous";
String server = "00.000.00.000";//url
InputStream inp = null;
try {
URL url = new URL("ftp://" + user + ":" + pass + "@" + server + remotePath + ";type=i");
URLConnection urlc = url.openConnection();
OutputStream os = urlc.getOutputStream();
File fichero = new File(localPath);
inp = new FileInputStream(fichero);
byte bytes[] = new byte[1024];
int readCount = 0;
while ((readCount = inp.read(bytes)) > 0) {
os.write(bytes, 0, readCount);
}
os.flush();
os.close();
inp.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
String pass = "00.000.00.000";//url
String localPath = "C:/Colores .png";
String remotePath = "/Colores.png";
String user = "anonymous";
String server = "00.000.00.000";//url
InputStream inp = null;
try {
URL url = new URL("ftp://" + user + ":" + pass + "@" + server + remotePath + ";type=i");
URLConnection urlc = url.openConnection();
OutputStream os = urlc.getOutputStream();
File fichero = new File(localPath);
inp = new FileInputStream(fichero);
byte bytes[] = new byte[1024];
int readCount = 0;
while ((readCount = inp.read(bytes)) > 0) {
os.write(bytes, 0, readCount);
}
os.flush();
os.close();
inp.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
java.io.FileNotFoundException: STOR Colores.png
ResponderEliminaralguna idea que me puede pasar
EliminarGracias Me funciono!!!
EliminarEsta muy bueno!
ResponderEliminar