damit blicke ich nicht durch: als test soll der das eben in den ordner: ord auf meinem desktop erstmal erstellen, was ich dann parallel natürlich mit dem ordner auf dem server machen will.
<?php
// Einstellungen:
// Verzeichnis, in das die Dateien hochgeladen werden;
// muss vorhanden sein und benötigt Schreiberechte (CHMOD 777):
$upload_dir = "uploaded_files";
// maximale Dateigröße in KB:
$max_file_size = 200;
// maximale Größe bei Bildern:
$max_image_width = 1024;
$max_image_height = 768;
// Datei-Typen:
$accepted_file_types = array('image/jpeg','image/pjpeg','image/gif','image/png','text/plain','text/html');
// Datei-Endungen:
$accepted_file_extensiones = array('jpg','jpeg','gif','png','txt','html','htm');
// Sprache:
$lang['title'] = 'Datei hochladen';
$lang['upload_subm_button'] = 'OK - Hochladen';
$lang['error_headline'] = 'Fehler:';
$lang['invalid_file_type'] = 'ungültiges Dateiformat ([file_type])';
$lang['invalid_file_extension'] = 'ungültige Datei-Erweiterung ([file_extension])';
$lang['file_too_large'] = 'Datei zu groß ([size] KB)';
$lang['image_too_large'] = 'Bild zu groß ([width] x [height])';
$lang['file_already_exists'] = 'die Datei <b>[file]</b> existiert bereits';
$lang['upload_successful'] = 'Die Datei [file] wurde erfolgreich hochgeladen!';
$lang['upload_not_successful'] = '<b>Fehler:</b> Die Datei [file] konnte nicht gespeichert werden!';
$lang['load_up_another_file'] = "eine weitere Datei hochladen...";
?><html>
<head>
<title><?php echo $lang['title']; ?></title>
<style type="text/css">
<!--
body { font-family: Verdana,Arial,Helvetica,sans-serif; color: #000000; font-size:13px; background-color: #fffff3; margin: 0px; padding: 20px; }
h1 { margin: 0px 0px 20px 0px; font-size:18px; font-weight:bold; }
.caution { color: red; font-weight: bold; }
.small { font-size: 11px; }
-->
</style>
</head>
<body>
<h1><?php echo $lang['title']; ?></h1>
<?php
if (isset($_FILES['probe']) && $_FILES['probe']['size'] != 0 && !$_FILES['probe']['error'])
{
unset($errors);
// file type ok?
if (!in_array($_FILES['probe']['type'], $accepted_file_types)) $errors[] = str_replace("[file_type]",$_FILES['probe']['type'],$lang['invalid_file_type']);
// extension ok?
$exts = explode(".", basename($_FILES['probe']['name']));
$file_extension = strtolower($exts[sizeof($exts)-1]);
if (!in_array($file_extension, $accepted_file_extensiones)) $errors[] = str_replace("[file_extension]",$file_extension,$lang['invalid_file_extension']);
// file size ok?
if ($_FILES['probe']['size'] > $max_file_size*1000) $errors[] = str_replace("[size]",number_format($_FILES['probe']['size']/1000,0,",",""),$lang['file_too_large']);
// if it's an image, image size ok?
if (in_array($_FILES['probe']['type'], $accepted_file_types) && in_array($_FILES['probe']['type'],array('image/jpeg','image/pjpeg','image/gif','image/png','image/bmp')))
{
$image_info = getimagesize($_FILES['probe']['tmp_name']);
if ($image_info[0] > $max_image_width || $image_info[1] > $max_image_width) { $lang['image_too_large'] = str_replace("[width]",$image_info[0],$lang['image_too_large']); $errors[] = str_replace("[height]",$image_info[1],$lang['image_too_large']); }
}
// filename already exists?
if (file_exists($upload_dir."/".basename($_FILES['probe']['name']))) $errors[] = str_replace('[file]',$_FILES['probe']['name'],$lang['file_already_exists']);
// if everything is ok load up the file:
if (empty($errors))
{
if (move_uploaded_file($_FILES['probe']['tmp_name'], $upload_dir.'/'.basename($_FILES['probe']['name'])))
{
chmod($upload_dir.'/'.$_FILES['probe']['name'], 0644);
?><p><?php echo str_replace('[file]', '<a href='.$upload_dir.'/'.$_FILES['probe']['name'].'>'.$_FILES['probe']['name'].'</a>',$lang['upload_successful']); ?></p>
<p class="small"><a href="C:\Dokumente und Einstellungen\sb\Desktop\ord"><?php echo $lang['load_up_another_file']; ?></a></p><?php
}
else
{
?><p><?php echo str_replace('[file]', $_FILES['probe']['name'],$lang['upload_not_successful']); ?></p><?php
}
}
// ...else show what's wrong:
else
{
?><p class="caution"><?php echo $lang['error_headline']; ?></p><ul><?php foreach($errors as $f) { ?><li><?php echo $f; ?></li><?php } ?></ul><br /><?php
}
}
// show the upload form:
if (empty($_FILES['probe']) || $_FILES['probe']['size'] == 0 || isset($errors))
{
?>
<form action="C:\Dokumente und Einstellungen\sb\Desktop\ord" method="post" enctype="multipart/form-data">
<input type="file" name="probe" /><br><br>
<input type="submit" name="submit-button" value="C:\Dokumente und Einstellungen\sb\Desktop\ord['upload_subm_button']; ?>">
</form>
<?php
}
?>
</body>
</html>