Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-25T17:48:01.233Z
Answers.Text: 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.
Answers.UserDisplayName: Vadim Goncharov
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-25T22:12:14.463Z
Answers.Text: Access from them PHP? Or you want to link to them directly from a template? Probably worth it's own separate post.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-26T02:06:27.440Z
Answers.Text: 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.
Answers.UserDisplayName: Vadim Goncharov
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-26T17:29:18.263Z
Answers.Text: Yeah, that's what I was going to suggest anyway. :)
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-22T20:22:31.760Z
Answers.LastActivityDate: 2014-09-22T20:22:31.760Z
Answers.UserDisplayName: Brad Bell
Body: <p>I have a plugin which needs to create a temporary file. Where should I put it?</p>
  
Tags: <plugin-development>
Title: Where should a plugin create temporary files
ThreadText: # 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. :)  
  
  ---
  
  