Taking a look at Assets 2.0 docs I can see that with the {exp:assets:folders} tag we can determine the folder where the photos are uploaded in a simple file uploading field, my question is if the same can be done with the regular assets field, so that when the users click on the button to add files they can see only the pre-determined folder and its subfolders? If this is possible then what is the code? I've only used a simple {field:field_name} to load Assets inside Safecracker so I'm not familiar with more complex solutions.

Thank you!

2 Answers 2


If you look at the field settings for your Assets field, you should see the option to restrict the available upload directories there.

  • 1
    That's not what I need, unfortunately. The idea is to give each user his own upload directory, so even if I restrict directories there the user will still have to see the directories of all the other users, which I don't want. For that reason the folder restrictions have to be done inside safecracker, so that the user can only see his own directory.
    – Isabel
    Jan 16, 2013 at 11:42
  • Maybe can you change the title of your question then. Something more specific like "Restrict upload directory to member using Assets and Safecracker". This helps others who might look for a similar solution.
    – GDmac
    Jan 16, 2013 at 12:23

I've got a deeper implementation of this, however as a basis you can hack Assets 2.1 to only show files uploaded by the logged in member when working with standard EE file sources.

First, add a 'member_id' column to the assets_files table:

ALTER TABLE  `exp_assets_files` ADD  `member_id` INT( 10 ) UNSIGNED NULL

Modify assets/sources/base_source.php (line 605) to add the member_id to the db table:

'file_name' => $filename,
'member_id' => $this->EE->session->userdata('member_id'), // Add 'member_id' to database
'kind' => Assets_helper::get_kind($filename)

Finally, modify assets/libraries/assets_lib.php (line 712) to limit the display of files to the currently logged in member only:

Change this existing line:

$this->EE->db->where_in('exp_assets_files.folder_id', $full_folder_list);

To this:

$this->EE->db->where_in('exp_assets_files.folder_id', $full_folder_list)->where('member_id', $this->EE->session->userdata('member_id'));
  • This is just a basic limiting example, I'm working on documenting our internal changes (we've added fieldtype params that can limit to session, member_id, entry_id) and will comment back here with a link to our implementation docs.
    – Michael P
    Apr 18, 2013 at 0:02
  • I would love to see your implementation docs if you've ever gotten them around.
    – adrienne
    Dec 13, 2013 at 18:34
  • the user can still overwrite another users file if the filenames are identical. otherwise works great. Jun 10, 2014 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.