When a file is opened in internet explorer without saving, it stores the file in temp folder. In windows 10 it creates a folder with random name in temp folder. I need to read the file using java. But java file api requires me to give the path of the file to read the contents of the file. How can I get the exact location of the file with the name that is stored by ie?
I tried using the java.io.tmpdir but it doesn't refer to the folder where the file is stored.
BufferedReader br = new BufferedReader(new FileReader(path to the file));
try {
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
sb.append(System.lineSeparator());
line = br.readLine();
}
String everything = sb.toString();
} finally {
br.close();
}
I expect exact file name and the path to the file location.