Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/webpages/lima-city/czibere/html/i/CDbQuery.php on line 22

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/webpages/lima-city/czibere/html/i/CDbQuery.php on line 22
Datei:

$_FILES:

Array
(
)

bilder im ordner './upload/':

Array
(
    [fish.gif] => 
    [iw3.png] => 
    [kopie_fish.gif] => 
    [kopie_kopie_fish.gif] => 
)


code

  
<?php
/**
 *  czibere.lima-city.de/_forum/shuyio1985/upload.php
 */

ini_set('display_errors''1');
error_reporting(E_ALL E_STRICT);
require_once 
"{$_SERVER['DOCUMENT_ROOT']}/tools/click/click.php";

$xsize 28000// maximale bilddateigröße in bites

$eol PHP_EOL;
echo <<< EOT
      <form action="" method="post" enctype="multipart/form-data">
        Datei: <input type="file" name="image"><br />
        <input type="submit" name="cupload" value="upload">
        <!-- input type="hidden" name="MAX_FILE_SIZE" value="
$xsize" -->
      </form>
$eol$eol
EOT;
echo 
"<h3>\$_FILES:</h3><pre>".print_r($_FILES,true)."</pre>";

if(isset(
$_FILES['image']) AND
   (
$_FILES['image']['error'] === 0) AND
   (
$_FILES['image']['size'] < $xsize)) {
#echo "<h1>HERE</h1>";
  
$bildinfo getimagesize($_FILES['image']['tmp_name']);
  if(
$bildinfo === false) {
      die(
'kein Bild');
  } else {
    
$mime $bildinfo['mime'];
    
$mimetypen = array (
        
'image/jpeg' => 'jpg',
        
'image/gif'  => 'gif',
        
'image/png'  => 'png'
      
);
    if(!isset(
$mimetypen[$mime])) {
      die(
'Nicht das richtige Format');
    } else {
      
$endung $mimetypen[$mime];
    }
    
$neuername basename($_FILES['image']['name']);
    
$neuername preg_replace("/\.(jpe?g|gif|png)$/i"""$neuername);
    
$neuername preg_replace("/[^a-zA-Z0-9_-]/"""$neuername);
    
$neuername .= ".$endung";
#exit(''.$neuername);
    
$ziel "upload/$neuername";
    while(
file_exists($ziel)) {
      
$neuername "kopie_$neuername";
      
$ziel "upload/$neuername";
    }
    if(
move_uploaded_file($_FILES['image']['tmp_name'], $ziel)) {
      echo 
'Wunderbar';
    } else {
      echo 
'Fehler';
    }
  }
} else {
  
$emsg = array(
    
'There is no error, the file uploaded with success.',
    
'The uploaded file exceeds the upload_max_filesize directive in php.ini.',
    
'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.',
    
'The uploaded file was only partially uploaded.',
    
'No file was uploaded.',
    
'',
    
'Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.',
    
'Failed to write file to disk. Introduced in PHP 5.1.0.',
    
'A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help. Introduced in PHP 5.2.0.'
  
);
  if(isset(
$_FILES['image'])) {
    echo 
"<hr /><h3>error message:</h3>
      <p><strong>
{$emsg[$_FILES['image']['error']]}</strong></p>$eol$eol";
  }
}


require_once 
'./getDirTree.php';
$dir print_r(getDirTree('./upload'),true);
echo <<< EOT
<hr /><h3>bilder im ordner './upload/':</h3>
<p>
  <pre>
$dir</pre>
</p>
EOT;

$f highlight_file(__FILE__,true);
echo <<< EOT
<hr /><h3>code</h3>
<pre>
  
$f
</pre>
EOT;