• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Uploading

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, if the file is in a cookie then you can get at it. Is that what you mean?
 
Philip Pross
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about <input type="file" enctype="multipart/form-data">? Usign it, you can upload stuff to the server.
 
What are you doing in my house? Get 'em tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic