5

In my Joomla site my users can upload and download files (docs and pdfs). So I want to create a separate folder for each and every user in my server. When a user register on my website a folder is create in the name of the user. If I delete a user the folder automatically should be deleted? Which file should I edit and how to write the code?

3 Answers 3

7

If you write a small User Plugin, you can use something like this to create the folder.

class PlgUserExample extends JPlugin
{
    public function onUserAfterSave($user, $isnew, $success, $msg)
    { 
        if($isnew) {
            // do something
        }
    }
}
4

There is a free module available at JED that can be configured to allow users to upload files to a folder with their username. Take a look at Simple File Upload. I've used it for one project, and it works fine, but at the end it depends on your specific requirements.

From the description:

It includes the following key features:

  • Multiple modules on the same page with different settings
  • "Add Note" to uploaded files
  • Image re-size
  • Automated thumbnail creation for images
  • Image compress for JPEG and PNG
  • Now supports both "User Named Directory" and "User Defined Directory"! (see below)
  • CAPTCHA
  • List files in upload directory in pop-up (FancyBox)
  • Multiple files upload
  • Notification e-mail
  • And more...

Other similar extensions might be found at http://extensions.joomla.org/extensions/core-enhancements/file-management

2

You can write a component and define build and parse methods (AKA YOURCOMPONENTBuildRoute and YOURCOMPONENTParseRoute functions) in your component's router.php instead of creating physical directories. Then, you need to create a menu with alias of user or users and link it to your component.

Your Answer

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

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