Answers.Body: <p>For Craft 3, there is <a href="https://github.com/fruitstudios/craft-uploadit" rel="nofollow noreferrer"><strong>UploadIt</strong></a>, a  front end asset uploader.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-24T15:25:46.183Z
Answers.LastActivityDate: 2019-01-24T15:25:46.183Z
Answers.UserDisplayName: Avant la lettre
Answers.Body: <p>Craft <a href="https://github.com/craftcms/cms/issues/3553" rel="nofollow noreferrer">doesn't store information</a> about the uploader for assets, so, if you want to make sure each user only sees their own respective assets, you could use <a href="https://docs.craftcms.com/v3/assets-fields.html#dynamic-subfolder-paths" rel="nofollow noreferrer">dynamic subfolder paths</a> and account for that when listing the available assets for that user. For example, you could use a dynamic path <code>user-uploads/{{currentUser.id}}</code>. Later, when querying for the assets, you could do</p>
  
  <pre><code>{% set folder = craft.app.assets.findFolder({path: 'user-uploads/' ~ currentUser.id}) %}
  {% set assets = craft.assets.folderId(folder.id).all() %}
  </code></pre>
  
  <p>Another approach to take when separating downloads into folders by users is making use of temporary upload folders, which are separate for each user. You can do that by calling <code>{% set folder = craft.app.assets.getCurrentUserTemporaryUploadFolder() %}</code>, which will set the <code>folder</code> variable to an instance of <code>craft\models\VolumeFolder</code>.</p>
  
  <p>You can use that as a starting point to build your own simple asset browser and then for saving asset relation data to any relations field (Assets, Entries, Users..) you just save the entry and <a href="https://craftcms.stackexchange.com/questions/18485/how-do-i-allow-a-user-to-remove-an-uploaded-asset-from-a-front-end-entry-form">submit a list</a> of ids that you want. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-17T13:29:16.367Z
Answers.Text: "not sure if you just had a "whoosh" moment or the question is about something else" -> the backend allows you to browse and therefore re-use or delete uploaded assets. The front end allows no such convenience. If you upload using a file upload field in a form, it creates a new file, even if you upload one with the same filename. So I was asking if there was a means to do so. I really dont think everyone should re-invent and develop their own assets browser for the front end so wanted to know if one exists.
Answers.UserDisplayName: Laurence Cope
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-17T14:07:08.273Z
Answers.Text: Unfortunately, I don't think anyone has built a front-end asset management component. But I've just updated my answer to show you how your users can see a list of assets they've already uploaded.
Answers.UserDisplayName: Andris Sevcenko
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-18T16:31:17.000Z
Answers.Text: Ok thanks. I guess a simple asset management system would therefore need to be built on every site that has a simple file upload field if you want to make sure duplicate files are not uploaded and give users the option to delete files from the server.
Answers.UserDisplayName: Laurence Cope
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-14T07:20:04.767Z
Answers.LastActivityDate: 2018-12-17T14:07:00.590Z
Answers.LastEditDate: 2018-12-17T14:07:00.590Z
Answers.UserDisplayName: Andris Sevcenko
Body: <p>I have a frontend entry form which included a file field to upload files to the entry. All works fine. I even have a delete function to remove individual uploaded files from the entry. </p>
  
  <p>The problem is if a user wants to attach a file they have already uploaded. Uploading the file results in the same file uploaded but with a different filename (a timestamp added to the end).</p>
  
  <p>This is going to result in unused files being left on the server and a nightmare version control going on - people left wondering what version is correct, which is being used, is it safe to delete the old ones etc. </p>
  
  <p>So ideally what is needed is the user can browse the assets uploaded on the front end and ideally be able to upload within that. </p>
  
  <p>Is there a facility to do this? </p>
  
  <p>Thanks</p>
  
Tags: <assets><frontend>
Title: How to browse uploaded assets on the front end?
ThreadText: # How to browse uploaded assets on the front end?
  
  (Asked by: username_0 on 2018-12-13)
  
  I have a frontend entry form which included a file field to upload files to the entry. All works fine. I even have a delete function to remove individual uploaded files from the entry.
  
  The problem is if a user wants to attach a file they have already uploaded. Uploading the file results in the same file uploaded but with a different filename (a timestamp added to the end).
  
  This is going to result in unused files being left on the server and a nightmare version control going on - people left wondering what version is correct, which is being used, is it safe to delete the old ones etc.
  
  So ideally what is needed is the user can browse the assets uploaded on the front end and ideally be able to upload within that.
  
  Is there a facility to do this?
  
  Thanks
  
  **Tags:** assets, frontend
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-01-24. Score: 3
  
  For Craft 3, there is [**UploadIt**](https://github.com/fruitstudios/craft-uploadit), a front end asset uploader.
  
  
  ---
  
  ### Answer by username_2 on 2018-12-14. Score: 2
  
  Craft [doesn't store information](https://github.com/craftcms/cms/issues/3553) about the uploader for assets, so, if you want to make sure each user only sees their own respective assets, you could use [dynamic subfolder paths](https://docs.craftcms.com/v3/assets-fields.html#dynamic-subfolder-paths) and account for that when listing the available assets for that user. For example, you could use a dynamic path `user-uploads/{{currentUser.id}}`. Later, when querying for the assets, you could do
  
  ```
  {% set folder = craft.app.assets.findFolder({path: 'user-uploads/' ~ currentUser.id}) %}
  {% set assets = craft.assets.folderId(folder.id).all() %}
  
  ```
  
  Another approach to take when separating downloads into folders by users is making use of temporary upload folders, which are separate for each user. You can do that by calling `{% set folder = craft.app.assets.getCurrentUserTemporaryUploadFolder() %}`, which will set the `folder` variable to an instance of `craft\models\VolumeFolder`.
  
  You can use that as a starting point to build your own simple asset browser and then for saving asset relation data to any relations field (Assets, Entries, Users..) you just save the entry and [submit a list](https://craftcms.stackexchange.com/questions/18485/how-do-i-allow-a-user-to-remove-an-uploaded-asset-from-a-front-end-entry-form) of ids that you want.
  
  > **Comments:**
  > **username_0**: "not sure if you just had a "whoosh" moment or the question is about something else" -> the backend allows you to browse and therefore re-use or delete uploaded assets. The front end allows no such convenience. If you upload using a file upload field in a form, it creates a new file, even if you upload one with the same filename. So I was asking if there was a means to do so. I really dont think everyone should re-invent and develop their own assets browser for the front end so wanted to know if one exists.  
  > **username_2**: Unfortunately, I don't think anyone has built a front-end asset management component. But I've just updated my answer to show you how your users can see a list of assets they've already uploaded.  
  > **username_0**: Ok thanks. I guess a simple asset management system would therefore need to be built on every site that has a simple file upload field if you want to make sure duplicate files are not uploaded and give users the option to delete files from the server.  
  
  ---
  
  