Exemple #1
0
 public static function prepareUploadsFolder($uploadsDirectory)
 {
     if (!$uploadsDirectory) {
         return false;
     }
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     $uploadsDirectory = 'web/assets/uploads';
     if (!$fs->exists($uploadsDirectory)) {
         $fs->mkdir($uploadsDirectory, 0777);
     }
     $user = PHP_OS == 'Darwin' ? get_current_user() : 'www-data';
     try {
         $fs->chown($uploadsDirectory, $user);
         $fs->chmod($uploadsDirectory, 0777);
     } catch (\Exception $e) {
         // Not sure If we need to show this errors. Let's think about that...
     }
 }