Tutorials Infos - Anleitungen - Hilfe - Dreamcodes
 

Upload Script

Einfaches Upload Script. Im Kopfteil wird das Script konfiguriert. $size ist die maximale Größe in Bytes

Script:

<?
if ($senden) {
$pfad = "../upload";  
$sizeabfrage = "yes";                              
$size = "20";                                 
                               
$body="<html><body bgcolor=#FFFFFF text=#000000>";
if (
$file_name == "") {
echo
$body;
die(
"Keine Datei gewählt.");
}
if (
file_exists("$pfad/$file_name")) {
die(
$body."Datei bereits vorhanden.");
}
if (
$sizeabfrage == "yes") {
if (
$file_size > $size) {
echo
$body;
die(
"Die Datei ist zu groß !");
}
}

$upload = "$file_name";
@
copy($file, "$pfad/$upload") or die($body."Datei wurde nicht hochgeladen.");
echo
$body;
echo
"Datei hochgeladen";
}
else {
?>

<html>
<body bgcolor=#FFFFFF text=#000000 link=#ccff88 vlink=ccff88 alink=#ccff88>
<form action="<?php $PHP_SELF; ?>"method="post" enctype="multipart/form-data">
<p>Bitte Datei auswählen:<br>
<input type=file name=file>
<p><button name="senden" type="submit">Hochladen</button>
</form>
</body>
</html>

<?
}
?>

 
ID: 359
eingestellt am: 18.03.2004
Autor: Hendrik Walter
Status zum lesen: Gast
gelesen: 14972
Webseite: www.dreamcodes.com
[Drucken]