I am reading byte data and writing a pdf file to my tomcat temp folder
FileOutputStream fos = new FileOutputStream(File.createTempFile("dummy-file", ".pdf"));
The file is written successfully.
In a later stage on my application I need to be able to read that file. Can I read any file directly from temp folder? I am not able to
I am using the below path to refer that file while reading.
file:///C:/liferay-developer-studio-1.3.1/Tools/Liferay%20Developer%20Studio/liferay-portal-6.0-ee-sp2/tomcat-6.0.32/temp/dummy-file68824607895269300.pdf //these numbers are string generated randomly while writing the file.
Using this url I see blank result. I assume there is another way to read urls from temp folder? Or is my url wrong?
First try the simple case:
…
If that works, you might try
pdfFile.toURI().Probably something like
file://C:/...(just 2 or 1 slashes).