Fejl i upload
Hej,Jeg får denne fejl, når jeg prøver at uploade en fil:
Warning: move_uploaded_file(/usr/local/apache2/htdocs/bbst/newsletters/newsletter003.pdf): failed to open stream: No such file or directory in /usr/local/apache2/htdocs/intranet/html/newsletterAdd.php on line 26
Warning: move_uploaded_file(): Unable to move '/tmp/phpbS4kHv' to '/usr/local/apache2/htdocs/bbst/newsletters/newsletter003.pdf' in /usr/local/apache2/htdocs/intranet/html/newsletterAdd.php on line 26
Med denne kode:
if ($submit){
// Uploader fil
$configuration["uploadDirectory"] = $_SERVER["DOCUMENT_ROOT"]."/bbst/newsletters";
$configuration["maxSize"] = "100";
$_FILES = $HTTP_POST_FILES;
$_POST = $HTTP_POST_VARS;
$_SERVER = $HTTP_SERVER_VARS;
if($_FILES["formFile"]["size"] > 0) {
$fra = $_FILES["formFile"]["tmp_name"];
$til = $configuration["uploadDirectory"] . "/" . $_FILES["formFile"]["name"];
$fil_stoerrelse = filesize($fra)/1024;
if($fil_stoerrelse > $configuration["maxSize"]) {
die("Desværre - filen er for stor. Max. størrelsen er " . $configuration["maxSize"] . "kb, og din fil fylder " . ceil($fil_stoerrelse) . "kb");
}
move_uploaded_file($fra, $til);
$fileName = $_FILES["formFile"]["name"];
$date = date("Y-m-d H:i:s");
mysql_query("INSERT INTO newsletters (newsletterText, newsletterFilename, newsletterDate) VALUES ('$formName','$fileName', '$date')") or die(handleError(mysql_error()));
// Add to log
$ip = $REMOTE_ADDR;
mysql_query("INSERT INTO log (logID, dato, userID, ip, logText) VALUES ('','$date','$SESSION_ID','$ip','bbst: nyhedsbrev oprettet')") or die(handleError(mysql_error()));
}
}
Jeg håber at nogen kan hjælpe.
VH
Anders Thingholm