IDTstudios1
Programmer
Is there anyway that the following java code can be pulled off by javascript? I know the two languages are very different so i'm asking before I dive into trying to figure it out myself. This will be for a firefox extension so that may clear up a few questions.
thanks
Code:
File f = new File("somefile.txt");
FileInputStream fis = new FileInputStream(f);
byte[] data = new byte[(int)f.length()];
fis.read(data);
fis.close();
String u = "[URL unfurl="true"]http://sync.foxysync.com/test.php?action=process&id=1";[/URL]
URL url = new URL(u);
HttpURLConnection huc = (HttpURLConnection)url.openConnection();
huc.setRequestMethod("POST");
huc.setDoOutput(true);
huc.setUseCaches(false);
huc.setFollowRedirects(true);
DataOutputStream dos = new DataOutputStream(huc.getOutputStream());
dos.write(data, 0, data.length);
dos.flush();
dos.close();
huc.disconnect();
thanks