0

I would like to allow users to manage their own files on my web application using a file manager. The specific file manager does not matter, but what I need to know is how to give each user access to their own file directory within my server storage directory (and only allow reading and writing within that folder).

In the backend, each user already has that folder set up as I was allowing them to upload single images before, but everything was handled on the back end, and now I don't understand how to give the user the ability to actually access that directory properly in such a way that the file manager can view and edit the directory contents.

Once again, the file structure already exists and the server side code performs actions within those directories, but now the question is how to expose those directories freely to the user after doing a check that it is their folder and they have the permissions to view / modify. Much appreciated.

FOR EXAMPLE:

ELFinder requires the following parameters:

function elFinderBrowser (field_name, url, type, win) {
  tinymce.activeEditor.windowManager.open({
    file: 'path/to/file', // use an absolute path!
    title: 'elFinder 2.0',
    width: 900,
    height: 450,
    resizable: 'yes'
  }, {
    setUrl: function (url) {
      win.document.getElementById(field_name).value = url;
    }
  });
  return false;
}

I can't just simply pass in to the file attribute storage/subdir/images because that's not publicly accessible. Also, if I pass in the url to the public directory, the file manager only seems to be able to view the directory web pages. It can't make changes (probably because the public folder is read only).

Marcel Gruber
  • 6,668
  • 6
  • 34
  • 60
  • Well, you can always checkout [TinyMCE's FileManager plugin](http://www.tinymce.com/wiki.php/MCFileManager:Installation), which has a PHP integration layer. Whether or not someone's done a Laravel integration, I don't know. – Jared Farrish Sep 14 '15 at 23:17
  • You could create your own! After login, a user will be shown his directories and upon clicking on a directory, he/she will be shown a simple list of all files in the directory. Uploading a new file, browsing a directory, deleting a file, all need to pass through you controller which will allow / deny access. This controller may output a json response... you get the picture (something like github does) – Jaspal Singh Sep 15 '15 at 00:26
  • Try to use / make something like this http://www.directorylister.com/ – Jaspal Singh Sep 15 '15 at 00:37
  • Perhaps this Topic help you :http://stackoverflow.com/questions/36840816/create-specific-upload-folder-based-on-user-role-and-limit-access-to-other-folde – Ahmad Badpey Apr 25 '16 at 19:15

0 Answers0