Computerhilfen.de Logo
Forum
Tipps
News
Frage stellen

upload-tool

Hallo Leudde,

hab mal wieder ein problem mit meinem Upload-Tool welches ich mit php erstellt habe!

Und zwar kann ich keine größeren Dateien hochladen! Mit größere Dateien meine ich ab 2,1 MB. Kleinere Dateien sind ohne weiteres möglich...

Hat jemand eine idee?
Würd mich freuen...

P.S.: habe die Werte in der php.ini bereits hochgesetzt, funzt aber dennoch nicht! Also wäre schön, wenn mir jemand was dazu sagen könnte!

Gruß
Znyper

 ???  ???  ???

« Letzte Änderung: 28.10.03, 14:38:02 von Znyper »

Antworten zu upload-tool:

willst du das skript mal zeigen? vielleicht kann ich dir dann helfen.

O.K. hier das script...

<?PHP

// special chars to be replaced

$signs = array("ä"," ","ö","ü","&","?","ß","+","~","/");
$bad_ext = array(".hta",".htp",".php",".pl",".cgi");
$root = "/server/path/to/home/";

// copy to this directory

if (!isset($dir)){

$dir = "c:\apache/htdocs/upload/dateien/";
$shortdir = "http://localhost/upload/dateien/";

}




?>


<html>
<head>
<title>Upload Directory</title>
<style>
body,td,input {font-family:verdana,arial;font-size:13px;}
th {text-align:left;font-size:13px}
</style>
</head>
<body>

<b>S-Upload-Tool der Sparkasse Neuss</b>
<hr size="1" noshade width="100%">
<br>

<?PHP

// events to be proceeded

// copy the file to the server

if (isset($submit)){


$userfile_name = str_replace($signs,"_",$userfile_name);
$userfile_name = str_replace($bad_ext,".txt",$userfile_name);

copy($userfile,$dir.$userfile_name);

if (!is_uploaded_file ($userfile)){

echo "<font color=red>Die Datei <b>$userfile_name</b> konnte nicht auf den Server geladen werden.</font>\n";
}


}



// check whether file has been uploaded

if (is_uploaded_file ($userfile)){

print "<font color=green>Die Datei <b>$userfile_name</b> wurde erfolgreich auf den Server geladen.</font>\n";

}




// change directory for listing

if (isset ($changedir)){

while(list($key, $val) = each($selection)) {

if(filetype($dir.$val) == "dir") {
$dir = $dir.$val."/";
$shortdir = $shortdir.$val."/";
}
else {
echo "<font color=red>Die Datei <b>$val</b> ist kein Ordner.</font>\n";
}
}

}



// change directory to next higher level for listing

if (isset ($cdup)){

$array = explode("/",$dir);
$array2 = explode("/",$shortdir);
$parts = count($array);
$parts2 = count($array2);
$updir = "";
$updir2 = "";


for($x=0;$x<($parts - "2");$x++) {
$updir = $updir.$array[$x]."/";
}

for($x=0;$x<($parts2 - "2");$x++) {
$updir2 = $updir2.$array2[$x]."/";
}

$z = substr_count($updir, $root);
if ( $z < "1"){

echo "<font color=red>Diese Aktion ist nicht erlaubt!</font>\n";

}
else {

$dir = $updir;
$shortdir = $updir2;

}
}



// delete file and dir

if (isset ($delete)){

while(list($key, $val) = each($selection)) {

if (filetype($dir.$val) == "dir"){

rmdir($dir.$val);
print "<font color=green>Der Ordner <b>$shortdir$val</b> wurde erfolgreich vom Server gel&ouml;scht.</font>\n";
}

else {

unlink($dir.$val);
print "<font color=green>Die Datei <b>$shortdir$val</b> wurde erfolgreich vom Server gel&ouml;scht.</font>\n";
}



}

}



// create new directory

if (isset ($createdir)){

$newdir = str_replace($signs,"_",$newdir);
mkdir($dir.$newdir,0755);
echo "<font color=green>Der Ordner <b>$newdir</b> wurde erstellt.</font>\n";

}







?>
&nbsp;<br>
<form name="uploadfile" enctype="multipart/form-data" action="<?PHP echo $PHP_SELF ?>" method="post">
<table border="0"><tr>
<td><b>Datei:</b> </td>
<td><input name="userfile" type="file" size="20">
<input type="hidden" name="dir" value="<?PHP echo $dir ?>">
<input type="hidden" name="shortdir" value="<?PHP echo $shortdir ?>">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000"></td>
<td><input type="submit" value="upload" name="submit"></td></tr>
</form>
<form name="createdir" enctype="multipart/form-data" action="<?PHP echo $PHP_SELF ?>" method="post">
<tr><td><b>Verzeichnis:</b> </td>
<td><input name="newdir" type="text" size="35">
<input type="hidden" name="shortdir" value="<?PHP echo $shortdir ?>">
<input type="hidden" name="dir" value="<?PHP echo $dir ?>"></td>
<td><input type="submit" value="create" name="createdir"></td></tr></table>
Bitte <b>nur einmal</b> klicken und auf die Best&auml;tigung warten
</form>
<a href="<?PHP echo $PHP_SELF ?>"><font color=blue>Startverzeichnis</font></a><br><br><br>



<hr size="1" noshade width="100%">
<b>Verzeichnis&uuml;bersicht</b> <?PHP print "$shortdir"; ?>
<hr size="1" noshade width="100%">

<form name="display" enctype="multipart/form-data" action="<?PHP echo $PHP_SELF ?>" method="POST">
<input type="hidden" name="dir" value="<?PHP echo $dir ?>">
<input type="hidden" name="shortdir" value="<?PHP echo $shortdir ?>">
<?PHP
$size_sum = "0";
echo "\n <table border=0 cellspacing=5>\n";
echo " <tr><td colspan='3'><input type='submit' name='cdup' value='cdup'></td></tr>";


echo " <tr><th colspan='2'></th><th width=120>Dateiname</th><th width=120>Dateigr&ouml;&szlig;e</th><th width=120>Upload-Zeit</th><tr>\n";
$verz=opendir ($dir);
$n = 0;

while ($file = readdir ($verz)) {

if($file != "." && $file != ".." && $file != $PHP_SELF && $file != ".htaccess" && $file != ".htpasswd") {

echo " <tr><td><input type=checkbox name=selection[$n] value=$file></td><td>";

if(filetype($dir.$file) == "dir") {
echo "<img src='icons/folder.gif' width='16' height='16' border='0' alt='directory'>";
}
elseif(filetype($dir.$file) == "file") {

echo "<img src='icons/binary.gif' width='16' height='16' border='0' alt='file'>";
}
else {

echo "<img src='icons/unknown.gif' width='16' height='16' border='0' alt='unknown'>";
}
echo "</td><td width=120><a href='$shortdir$file' target='_blank'><font color=brown>$file</font></a></td><td width=120> (".number_format(filesize($dir.$file)/1000,3,",",".")." Kb)</td><td>".gmdate("d M Y - H:i:s", filemtime($dir.$file))."</td></tr>\n";
$size_sum = $size_sum + number_format(filesize($dir.$file),3,",","");
$n ++;
}
}
closedir($verz);
$output = number_format($size_sum/1000,3,",",".");
echo " <tr><th colspan='2'></th><th>Summe:</th><th>".$output." Kb</th></tr>\n";
echo " </table>\n";
?>
<hr size="1" noshade width="100%">
<input type='submit' value='delete' name='delete'>
<input type='submit' value='GoTo' name='changedir'>

</form>
<br><br>

</body>
</html>


hoffe jemand kann mir helfen...

MfG
Znyper


- copy() ist nicht gut, verwende lieber move_uploaded_file()
- die ~2MB-Grenze könnte am Script-Laufzeit-Timeout liegen, siehe set_time_limit(0)
- oder an Limits bzgl. maximaler POST request Größe, das kann man beim Apache in httpd.conf einstellen

schau doch einfach mal in die error_log vom Apache, was der da sagt. ansonsten schauste mal ins Community Forum bei http://jupload.biz/ da gibts sicherlich antworten dazu.


« BuildAdminpasswort definieren »
 

Schnelle Hilfe: Hier nach ähnlichen Fragen und passenden Tipps suchen!

Fremdwörter? Erklärungen im Lexikon!
Dateiendungen
Die Dateiendung, auch Dateinamenerweiterung, Dateierweiterung oder einfach "Endung" genannt, besteht aus meistens drei oder vier Buchstaben und wird mit einem Punkt an de...

Dateiendung
Die Dateiendung ist ein Teil des Dateinamen und zeigt das Dateiformat an. Klassisch war die "8.3" Regelung, nach der der Dateiname under MS DOS 8 Zeichen lang sein durfte...

Auslagerungsdatei
Die Auslagerungsdatei, auch bekannt als virtueller Speicher, ist ein wichtiges Element im Windows-Betriebssystem. Sie dient als Erweiterung des physischen Arbeitsspeicher...