Hallo zusammen,
wer kann mir bei folgendem PHP/File-Upload Problem weiterhelfen?
Das Script zum Uploaden habe ich aus dem eventuell bekannten Buch "PHP - Grundlagen und Lösungen" von Jörg Krause übernommen, musste es jedoch noch ein wenig modifizieren:
____________________________________________________________________
<?
if($action1 )
{
//if files have been upleaded, process them
?>
<html>
<head>
<title>File Upload Result</title>
<meta http-equiv="Content-Type" _
content="text/html; chaset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><font face="arial, helvetica,sans-serif">
<font size="+1">File Upload Result</font><br><br>
<?
// Pfadangebe fuer das Ziel
$path1 = addSlashes(dirname($PATH_TRANSLATED))."\upload";
// maximale 4 Dateien gleichzeitig
for($i = 0; $i < 4; $i++)
{
// Bildung der Variablennamen
switch($i)
{
case 0:
$source = $file1;
$source_name = $file1_name;
break;
case 1:
$source = $file2;
$source_name = $file2_name;
break;
case 2:
$source = $file3;
$source_name = $file3_name;
break;
case 3:
$source = $file4;
$source_name = $file4_name;
break;
}
if (($source != "none") && ($source != ""))
{
if ($error1 != 1)
{
$dest = $path1.$source_name;
if (copy($source, $dest))
{
echo "$source_name has been upleaded"; }
else
{
echo "Upload directory not write-enabled";
$error1 = 1;
}
}
unlink($source);
}
}
?>
</font></p>
</body>
</html>
<?
}
else
{
?>
<html>
<head>
<title>File Uplead</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><font face="arial, Helvetica; sans-serif">
<font size="+1">File Upload</font><br><br>
If our browser is upload-enabled, you will see
quot;Browse" (Netscape, Internet Explorer) or ". .
." (Opera) buttons below. Use them to select file(s) to
upload, then been uploaded, you will see a results screen.<br>
<form method="post"
enctype="multipart/from-data"
action="fileupload.php3">
<input type="hidden" name="MAX_FILE_SIZE" value="400000">
<input type="hidden" name="action1" value="1">
File 1: <input type="file" name="file1" size="30"><br>
File 2: <input type="file" name="file2" size="30"><br>
File 3: <input type="file" name="file3" size="30"><br>
File 4: <input type="file" name="file4" size="30"><br>
<input type="submit" value="Upload">
</form>
</font></p>
</body>
</html>
<?
}
?>
_____________________________________________________________________
Hier die Veränderungen, die ich vorgenommen habe:
1.) $path1 = addSlashes(dirname($PATH_TRANSLATED))."\upload\";
--> $path1 = addSlashes(dirname($PATH_TRANSLATED))."\upload";
2.) Vergleichsoperator <> --> !=
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Beim Testen jedoch erhalte ich im Browser nur folgende Meldung:
_____________________________________________________________________
File Upload Results
Parse error: parse error in /home/strato/www/we/www.web-e.de/htdocs/php-bin/fileupload.php3 on line 42
_____________________________________________________________________
...wobei Zeile 42 diese ist:
_____________________________________________________________________
if (copy($source, $source_name))
_____________________________________________________________________
Was für eine Art Fehler ist das?
Ich bin für jeden Hinweis dankbar (es ist sehr dringend).
Danke im Vorraus
MfG
René
P.S: Nützlich wäre auch ein bereits erprobtes Script.