• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help with posting files from Applets to PHP

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a few questions regarding uploading files to a HTTp request (from an applet). This is what I am following:
I am taking a screenshot of the screen using Applet's robot and storing the same on the local file system. The file I have saved on the local file system needs to be uploaded to Apache, eventually to be accessed by PHP.

public void sendBufferedImage(File file, BufferedImage screenImage, String urlPath) throws Exception
{

ImageIO.write(screenImage, "GIF", file); // This is to store the file in a temp location on the local file system.
url = new URL(urlPath);
urlcon = (HttpURLConnection) url.openConnection();
urlcon.setRequestMethod("POST");
urlcon.setDoOutput(true);
urlcon.connect();
out = new DataOutputStream(urlcon.getOutputStream());
out.write(file.getPath().getBytes());
}
Does this complete writing the file to the HTTP request?
1. If so, how should reading the HTTP request work to get the file handle out of the byte array written to the HTTP request?
2. Can a file be written to the HTTP request only via byte array?
3. A sample of how the php code would look like while getting the file handle out of the HTTP request would help a great deal.

Thanks,
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic