Answers.Body: <p>First you create an asset source <code>uploads</code>. Then you create an asset field and set its upload location subfolder to <code>{postDate|date('Y')}/{postDate|date('m')}</code></p>
  
  <p>When you edit an entry, any files you upload will go in the subfolder for the year and date. If you have selected <strong>Restrict uploads to a single folder?</strong> in the asset field, then only assets in that subfolder can be used.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-08T23:33:06.257Z
Answers.Text: Perfect thank you! I missed the **Restrict uploads to a single folder?**
Answers.UserDisplayName: Seán O'Grady
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-08T17:19:17.007Z
Answers.LastActivityDate: 2014-07-08T17:19:17.007Z
Answers.UserDisplayName: Marion Newlevant
Body: <p>I have a directory structure in place that I'd like to mimic in Craft. File uploads are first categorised by Year, then by month so the directory sturcture is like such</p>
  
  <pre><code>-- 2014
  ---- 01
  ---- 02
  ---- 03
  ---- 04
  ---- 05
  ---- 06
  </code></pre>
  
  <p>I've tried this but it still only uploads to the root folder I setup in sources</p>
  
  <pre><code>/uploads/{postDate.format('Y')}/{postDate.format('M')}
  </code></pre>
  
  <p>Am I using the wrong syntax? Do I need to use now | date ('Y') instead?</p>
  
Tags: <entries><assets>
Title: How can I set my upload path by date?
ThreadText: # How can I set my upload path by date?
  
  (Asked by: username_0 on 2014-07-08)
  
  I have a directory structure in place that I'd like to mimic in Craft. File uploads are first categorised by Year, then by month so the directory sturcture is like such
  
  ```
  -- 2014
  ---- 01
  ---- 02
  ---- 03
  ---- 04
  ---- 05
  ---- 06
  
  ```
  
  I've tried this but it still only uploads to the root folder I setup in sources
  
  ```
  /uploads/{postDate.format('Y')}/{postDate.format('M')}
  
  ```
  
  Am I using the wrong syntax? Do I need to use now | date ('Y') instead?
  
  **Tags:** entries, assets
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-07-08. Score: 3 | Accepted answer
  
  First you create an asset source `uploads`. Then you create an asset field and set its upload location subfolder to `{postDate|date('Y')}/{postDate|date('m')}`
  
  When you edit an entry, any files you upload will go in the subfolder for the year and date. If you have selected **Restrict uploads to a single folder?** in the asset field, then only assets in that subfolder can be used.
  
  > **Comments:**
  > **username_0**: Perfect thank you! I missed the **Restrict uploads to a single folder?**  
  
  ---
  
  