Skip to content
This repository has been archived by the owner on Apr 23, 2019. It is now read-only.

Configuring tmp file directory #45

Closed
enzeart opened this issue Dec 25, 2017 · 2 comments
Closed

Configuring tmp file directory #45

enzeart opened this issue Dec 25, 2017 · 2 comments

Comments

@enzeart
Copy link

enzeart commented Dec 25, 2017

The documentation is unclear as to how one would go about configuring the directory used to store the temporary files created during file uploads.

@wsargent
Copy link
Member

wsargent commented Dec 27, 2017

The example uses java.nio.files.Files.createTempFile and the Javadoc for that method is https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createTempFile(java.lang.String,%20java.lang.String,%20java.nio.file.attribute.FileAttribute...) which explains where the directory comes from -- it's part of the Files NIO API. This is shown in the example code here oin the readme: https://github.com/playframework/play-java-fileupload-example#customizing-the-body-parser

If you want to configure another directory, you use another method that would send it somewhere else.

@enzeart
Copy link
Author

enzeart commented Dec 30, 2017

@wsargent I wanted to avoid creating a new BodyParser as it seemed like overkill for something so simple.

Your documentation reference pointed me in the right direction. The createTempFile method uses the default system temporary directory which can be configured with the System Property java.io.tmpdir.

So passing -Djava.io.tmpdir="directory name" to the JVM worked like a charm.

@enzeart enzeart closed this as completed Dec 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants