| Author |
Uploading
|
Philip Pross
Ranch Hand
Joined: Jan 17, 2001
Posts: 76
|
|
Hello people, When we talk about "sign applets" this is mainly for reading a clients PC, but if I'm correct ... could we read with an application. The main purpose is I have a class where I look up a url with a certain door and make a copy of it on my hard drive, import java.net.*; import java.io.*; class ReadUrl { public static void main(String[] args) { try { // Define a URL URL sourceURL = new URL( "http://mywebsite.qc.ca/door/2424"); // Get a character input stream for the URL BufferedReader in = new BufferedReader( new InputStreamReader( sourceURL.openStream())); // Create the stream for the output file PrintWriter out = new PrintWriter( new BufferedWriter( new FileWriter( new File("C:/mydir/test.java")))); // Read the URL and write it to a file String buffer; // Buffer to store lines while(!(null==(buffer=in.readLine()))) out.println(buffer); in.close(); // Close the input stream out.close(); // Close the output file } catch(MalformedURLException e) { System.out.println("Failed to create URL:\n" + e); } catch(IOException e) { System.out.println("File error:\n" + e); } } } But now I need to look in a clients machine (laptop) because he is traveling and if a cretain file exist upload it to my server. Can someone help me because I'm Phil
|
 |
Cindy Glass
"The Hood"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
|
|
|
Well, if the file is in a cookie then you can get at it. Is that what you mean?
|
"JavaRanch, where the deer and the Certified play" - David O'Meara
|
 |
Philip Pross
Ranch Hand
Joined: Jan 17, 2001
Posts: 76
|
|
I'll start over .... I want a client to be able to upload a file to my server, with an application. With the class above I do open the port 2424, but the file is empty. To download a file from the server to a client is simply, in my mind to upload shouldn't be that different.  Phil
|
 |
Vlad Patryshev
Ranch Hand
Joined: Jun 30, 2001
Posts: 61
|
|
|
How about <input type="file" enctype="multipart/form-data">? Usign it, you can upload stuff to the server.
|
Thanks,<br />Vlad
|
 |
 |
|
|
subject: Uploading
|
|
|