コード例 #1
0
ファイル: html.php プロジェクト: gpawlik/suited-php-classes
 /**
  * sets a file field with info about max file size
  * @param string $filename 
  * @param int $max_bytes
  * @param array $options
  */
 public static function fileWithLabel($filename, $max_bytes, $options = array())
 {
     $bytes = upload::getNativeMaxUpload();
     if ($max_bytes < $bytes) {
         $bytes = $max_bytes;
     }
     self::hidden('MAX_FILE_SIZE', $bytes);
     $label = lang::translate('Max size per file') . ". ";
     $size = upload::bytesToGreek($bytes);
     $label .= $size;
     if (isset($options['multiple'])) {
         $max_files = ini_get('max_file_uploads');
         $label .= "<br />";
         $label .= lang::translate('Max number of files: <span class="notranslate">{MAX_FILES}</span>', array('MAX_FILES' => $max_files));
     } else {
         $label .= "<br />";
         $label .= lang::translate('Only one file at a time');
     }
     self::label($filename, $label);
     self::file($filename, $options);
 }