void copy() { try{ File inputFile = new File( "c:\\winnt\\system32\\testall.dll"); URL copyurl; InputStream outputFile; copyurl=new URL("http://<server ipaddress>:8080/Samples/testall.dll"); outputFile=copyurl.openStream(); FileOutputStream out = new FileOutputStream(inputFile); int c; while ((c = outputFile.read()) != -1) out.write(c); outputFile.close(); out.close(); }catch(Exception e){ System.out.println("Failed to Copy File from server"); e.printStackTrace(); } }
void copyprop() { try{ File inputFile = new File( "c:\\winnt\\system32\\propert.properties"); URL copyurl; InputStream outputFile; copyurl=new URL("http://<server ipaddress>:8080/Samples/propert.properties"); outputFile=copyurl.openStream(); FileOutputStream out = new FileOutputStream(inputFile); int c; while ((c = outputFile.read()) != -1) out.write(c); outputFile.close(); out.close(); }catch(Exception e){ System.out.println("Failed to Copy File from server"); e.printStackTrace(); } }
public static void main(String args[]) throws IOException { testsett ts = new testsett(); ts.copyprop(); ts.copy(); } }
but this code is not working.. is there any modifications to be made to this code to copy file from applet server to client.
thank you in advance
msi_333
Question subject: Re: copy files from applet server to client
Posted: Fri Jul 31, 2009 9:28 am
Joined: Tue Mar 27, 2007 10:55 pm Posts: 2103 Location: Earth Has thanked: 39 time Have thanks: 56 time
hey , i think you want to code a FTP java Client . right . to Read a file from your server you need to have security policy . Did you run it . what is the output of it .
You can use this to get user home :
Code:
System.getProperty("user.home" );
_________________ Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )
ceazer
Question subject: Re: copy files from applet server to client
Posted: Fri Jul 31, 2009 12:53 pm
Joined: Fri Mar 27, 2009 2:57 pm Posts: 2 Has thanked: 0 time Have thanks: 0 time