How to access temp files in AEM? | Community
Skip to main content
Level 2
June 23, 2017
Solved

How to access temp files in AEM?

  • June 23, 2017
  • 2 replies
  • 3280 views

Hi,

I am creating a temp file using following method in OSGI bundle.

Files.createTempFile("temp", ".json"); .

When I run the script in my local server it is getting created under  C:/Users/vasim/AppData/Local/Temp/temp1233433455.txt. I am accessing that file in my javaScript and doing some operations on it. I have deployed the code in UAT server. In UAT it is creating files  /opt/aem/. Now I am unable to access that file in my JavaScript. I tried by creating file under /content. Then also it is not working.

Regards,

Vasim

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Feike_Visser1

You can't access files on the filesystem through JCR, you would do that via the Java File api.

2 replies

Feike_Visser1
Adobe Employee
Feike_Visser1Adobe EmployeeAccepted solution
Adobe Employee
June 23, 2017

You can't access files on the filesystem through JCR, you would do that via the Java File api.

Level 4
June 23, 2017

You might add -Djava.io.tmpdir=somepath to your instance so you can control the temp file location and manage it for your application.