[PHP] Upload Script - Variabel Probs?
Heyho ihr WebDev-Forum User :D
Hab mal wieder eine nette kleine Herausforderung für euch: Mein kleines Upload-Script will irgendwie nicht so richtig.
Hab mir ein relativ simples Script gebaut wo man alle Datei-Endungen der Welt hochladen kann und man auch nicht auf die Größe schauen muss. ABER irgendwie bekomm ich immer den Fehler dass er eine Variabel nicht lesen kann, was aber nicht so richtig sein kann.
Schaut selbst:
Code:
<html>
<head>
</head>
<body>
<p>
<?
$status = $_GET['upload'];
if ($status=='1')
{
$form_password = $_POST['password'];
include("config.php");
if ($form_password == $password)
{
copy("$file","$upload_folder$file_name");
echo "<center><div class='norm'><b>$file_name was successfully uploaded.</b></div></center>";
}
else
{
echo "<center><div class='norm'><b>The upload password was not correct, please go back and re-enter the password correctly.</b></div></center>";
}
}
else
{
?>
<table>
<form action="<? $self_file = $_SERVER['PHP_SELF']; echo "$self_file"; ?>?upload=1" enctype="multipart/form-data" method="post">
<tr>
<td style="padding:2px">Passwort:</td>
<td style="padding:2px"><input name="password" type="password" cols="30"></td>
</tr>
<tr>
<td style="padding:2px">Datei:</td>
<td style="padding:2px"><input name="file" type="file" class="textarea"></td>
</tr>
<tr>
<td align="center"><input name="Submit" type="submit" value="Upload" ></td>
</tr>
</form>
<?
}
?>
</table>
</p>
</body>
</html>
Jetzt bekomm ich dauernd die Fehlermeldung:
copy(): Unable to access in /www/htdocs/public/scripts/upload/index2.php on line 42
Wobei Zeile 42 hier diese wäre:
Code:
copy("$file","$upload_folder$file_name");
Nur hab ich jetzt grad keine Ahnung was da falsch ist...
Nur zu Info. Es wird am Anfang des Scripts die Datei "config.php" includiert, in dieser Datei ist lediglich mein Passwort und der Upload-Order gespeichert.
Code:
<?php
$password = 'meinpasswort';
$upload_folder = 'uploadordner/';
?>
Das wär das eine, und nur so nebenbei, gibt es eine PHP Funktion mit der mir der Syntax einer .PHP/.HTML/-Datei farbig angezeigt werden kann?
THANKS!
A2k