Beispiel #1
0
 /* if the upload button was pressed */
 if ($upload) {
     global $_FILES;
     //	echo $_FILES['uploadedfile']['name'];
     /* if a file was actually uploaded */
     if ($_FILES['uploadedfile']['name']) {
         $_FILES['uploadedfile']['name'] = strip_tags($_FILES['uploadedfile']['name']);
         $_FILES['uploadedfile']['name'] = str_replace($snr, "", $_FILES['uploadedfile']['name']);
         // remove any % signs from the file name
         $_FILES['uploadedfile']['name'] = trim($_FILES['uploadedfile']['name']);
         /* if the file size is within allowed limits */
         if ($_FILES['uploadedfile']['size'] > 0 && $_FILES['uploadedfile']['size'] < $MaxFileSize) {
             /* if adding the file will not exceed the maximum allowed total */
             if ($HDDTotal + $_FILES['uploadedfile']['size'] < $HDDSpace) {
                 if (TargetOK($_FILES['uploadedfile']['name']) == 1) {
                     if (OffFile($_FILES['uploadedfile']['name'])) {
                         $OffExt = ".off";
                     }
                     /* put the file in the directory */
                     //                        @copy($_FILES['uploadedfile']['tmp_name'], $path.$pathext.$_FILES['uploadedfile']['name'].$OffExt);
                     @copy($_FILES['uploadedfile']['tmp_name'], $path . $pathext . $_FILES['uploadedfile']['name']);
                 } else {
                     $msg = "<font face='Verdana, Arial, Hevetica' size='2' color='#ff0000'>The Filename:  " . $_FILES['uploadedfile']['name'] . " " . _ADMIN_FILEMANAGER_UPLOAD_NOTYPE . "</font><p>";
                 }
             } else {
                 $msg = "<font face='Verdana, Arial, Hevetica' size='2' color='#ff0000'>" . _ADMIN_FILEMANAGER_UPLOAD_NOSPACE . "</font><p>";
             }
         } else {
             $MaxKB = setsize($MaxFileSize);
             // show the max file size in Kb
             $msg = "<font face='Verdana, Arial, Hevetica' size='2' color='#ff0000'>" . _ADMIN_FILEMANAGER_UPLOAD_NOSIZE . " {$MaxKB} " . _ADMIN_FILEMANAGER_UPLOAD_NOSIZE1 . "</font><p>";
Beispiel #2
0
 $HDDTotal = dirsize($path);
 // get the total size of all files in the directory including any sub directorys
 /* if the upload button was pressed */
 if ($upload) {
     /* if a file was actually uploaded */
     if ($HTTP_POST_FILES['uploadedfile']['name']) {
         $HTTP_POST_FILES['uploadedfile']['name'] = strip_tags($HTTP_POST_FILES['uploadedfile']['name']);
         $HTTP_POST_FILES['uploadedfile']['name'] = str_replace($snr, "", $HTTP_POST_FILES['uploadedfile']['name']);
         // remove any % signs from the file name
         $HTTP_POST_FILES['uploadedfile']['name'] = trim($HTTP_POST_FILES['uploadedfile']['name']);
         /* if the file size is within allowed limits */
         if ($HTTP_POST_FILES['uploadedfile']['size'] > 0 && $HTTP_POST_FILES['uploadedfile']['size'] < $MaxFileSize) {
             /* if adding the file will not exceed the maximum allowed total */
             if ($HDDTotal + $HTTP_POST_FILES['uploadedfile']['size'] < $HDDSpace) {
                 if (TargetOK($HTTP_POST_FILES['uploadedfile']['name']) == 1) {
                     if (OffFile($HTTP_POST_FILES['uploadedfile']['name'])) {
                         $OffExt = ".off";
                     }
                     /* put the file in the directory */
                     move_uploaded_file($HTTP_POST_FILES['uploadedfile']['tmp_name'], $path . $pathext . $HTTP_POST_FILES['uploadedfile']['name'] . $OffExt);
                 } else {
                     $msg = "<font face='Verdana, Arial, Hevetica' size='2' color='#ff0000'>The Filename: " . $HTTP_POST_FILES['uploadedfile']['name'] . " is BLOCKED from being uploaded here.</font><p>";
                 }
             } else {
                 $msg = "<font face='Verdana, Arial, Hevetica' size='2' color='#ff0000'>There is not enough free space and the file could<br>not be uploaded.</font><p>";
             }
         } else {
             $MaxKB = setsize($MaxFileSize);
             // show the max file size in Kb
             $msg = "<font face='Verdana, Arial, Hevetica' size='2' color='#ff0000'>The file was greater than the maximum allowed<br>file size of {$MaxKB} and could not be uploaded.</font><p>";
         }