<p><a href="http://buildwithcraft.com/classreference/services/PathService" rel="nofollow">PathService</a> has a <a href="http://buildwithcraft.com/classreference/services/PathService#getTempPath-detail" rel="nofollow">getTempPath()</a> method which will return the <code>craft/storage/runtime/temp</code> path by default.</p>

<p>Craft uses that for its temporary files and so can plugins.  Just make sure youre plugin is being defensive by giving it a unique filename or create a folder with a unique name and put your files in there, etc.</p>

CC BY-SA 3.0
2015-09-25T17:48:01.233Z
Is there a way to directly access files that are placed in the `/storage` folder? I get file not found if I try to link to it.
Vadim Goncharov
CC BY-SA 3.0
2015-09-25T22:12:14.463Z
Access from them PHP? Or you want to link to them directly from a template? Probably worth it's own separate post.
Brad Bell
CC BY-SA 3.0
2015-09-26T02:06:27.440Z
Yeah I was trying to link to them from a template, or display it on the template (for pictures). But haven't had any luck. However, now I set up my plugin so files get saved to a location in my plugin resources folder and now able to get the files, so I might just keep this route for now.
Vadim Goncharov
CC BY-SA 3.0
2015-09-26T17:29:18.263Z
Yeah, that's what I was going to suggest anyway. :)
Brad Bell
CC BY-SA 3.0
2014-09-22T20:22:31.760Z
2014-09-22T20:22:31.760Z
Brad Bell
<p>I have a plugin which needs to create a temporary file. Where should I put it?</p>

<plugin-development>
Where should a plugin create temporary files
# Where should a plugin create temporary files

(Asked by: username_0 on 2014-09-22)

I have a plugin which needs to create a temporary file. Where should I put it?

**Tags:** plugin-development

---

## 1 answers

### Answer by username_1 on 2014-09-22. Score: 4 | Accepted answer

[PathService](http://buildwithcraft.com/classreference/services/PathService) has a [getTempPath()](http://buildwithcraft.com/classreference/services/PathService#getTempPath-detail) method which will return the `craft/storage/runtime/temp` path by default.

Craft uses that for its temporary files and so can plugins. Just make sure youre plugin is being defensive by giving it a unique filename or create a folder with a unique name and put your files in there, etc.

> **Comments:**
> **username_2**: Is there a way to directly access files that are placed in the `/storage` folder? I get file not found if I try to link to it.  
> **username_1**: Access from them PHP? Or you want to link to them directly from a template? Probably worth it's own separate post.  
> **username_2**: Yeah I was trying to link to them from a template, or display it on the template (for pictures). But haven't had any luck. However, now I set up my plugin so files get saved to a location in my plugin resources folder and now able to get the files, so I might just keep this route for now.  
> **username_1**: Yeah, that's what I was going to suggest anyway. :)  

---

