コード例 #1
0
ファイル: FoxFWFile.php プロジェクト: Elrenardo/FoxFWcms-4
 public static function uploadFile($destination, $max_size = NULL, $tab_ext = NULL)
 {
     $ret = array();
     $error = false;
     //verifier les erreurs du fichier
     foreach ($_FILES as $file_name) {
         if (!$file_name['error']) {
             $error = false;
             //verifier taille du fichier
             if (isset($max_size)) {
                 if ($file_name['size'] > $max_size) {
                     array_push($ret, -1);
                     $error = true;
                 }
             }
             //verifier extension
             if (isset($tab_ext)) {
                 $extension_upload = strtolower(substr(strrchr($file_name['name'], '.'), 1));
                 if (!in_array($extension_upload, $extensions_valides)) {
                     array_push($ret, -2);
                     $error = true;
                 }
             }
             //si pas d'erreur on continu
             if (!$error) {
                 //transfert fichier
                 $nom = $destination . FoxFWFile::encodeString($file_name['name']);
                 //transfert du fichier a ca bonne destination
                 move_uploaded_file($file_name['tmp_name'], $nom);
                 //ajout nom du fichier
                 array_push($ret, $nom);
             }
         }
     }
     return $ret;
 }
コード例 #2
0
 public function addDir($params)
 {
     if (!isset($_GET['name'])) {
         FoxFWKernel::loadRouter('index');
     }
     $url = $this->path->get() . '/' . FoxFWFile::encodeString($_GET['name']);
     mkdir($url, 0777, true);
     FoxFWKernel::loadRouter('Document_view');
 }
コード例 #3
0
ファイル: FoxFWKernel.php プロジェクト: Elrenardo/FoxFWcms-4
 public static function URLencode($str, $charset = 'utf-8')
 {
     return FoxFWFile::encodeString($str, $charset);
 }