Hjælp til upload-script fra one.com
Har fået et upload-script fra one.com, som burde virke i safe_mode, men jeg får en fejl i linje 17 i upload.php når jeg prøver.Først scriptet fra one.com:
uploadform.php
<form action="upload.php" method="post" enctype="multi
part/form-data">
<p>Pictures:
<input type="file" name="pictures[]" />
<input type="submit" value="Send" />
</p>
</form>
upload.php
<?php
//places files into same dir as form resides
foreach ($_FILES["pictures"]["error"] as
$key => $error) {
if ($error == UPLOAD_ERR_OK) {
move_uploaded_file(
$_FILES["pictures"]["tmp_name"][$key],
$_FILES["pictures"]["name"][$key]
) or die("Problems with upload");
}
}
echo "Your files, were uploaded succesfull";
echo "<br />";
echo "<a href='uploadform.php'>go back</a>";
?>
Mit forsøg ser således ud, først uploadform.php:
<?php require_once('../Connections/-------.php');
mysql_select_db($database_--------, $--------);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="../css/bodystyle.css" rel="stylesheet" type="text/css" />
<link href="../css/skriftstyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
<span class="dagbogmenu">
<?php
if (isset($_FILES['billednavn'])) {
print "Fil, der er blevet overført: {$_FILES['billednavn']['name']}<p>\n";
$query = "INSERT INTO billeder SET billednavn='".$_FILES['billednavn']['name']."'";
$Result1 = mysql_query($query, $----------) or die(mysql_error());
}
if (isset($_FILES['billednavn'])){
$tempfile = $_FILES['billednavn']['tmp_name'];
$destination = "../billeder/galleri/{$_FILES['billednavn']['name']} ";
copy($tempfile, $destination);
}
?>
<form action="upload.php" method="post" enctype="multi
part/form-data">
<p>Pictures:
<input type="file" name="billednavn[]" />
<input type="submit" value="Send" />
</p>
</form>
</span>
</body>
</html>
Så kommer upload.php:
<?php require_once('../Connections/-------.php');
mysql_select_db($database_------------, $---------);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="../css/bodystyle.css" rel="stylesheet" type="text/css" />
<link href="../css/skriftstyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
<span class="dagbogmenu">
<?php
//places files into same dir as form resides
foreach ($_FILES["billednavn"]["error"] as
$key => $error) {
if ($error == UPLOAD_ERR_OK) {
move_uploaded_file(
$_FILES["billednavn"]["tmp_name"][$key],
$_FILES["billednavn"]["name"][$key]
) or die("Problems with upload");
}
}
echo "Your files, were uploaded succesfull";
echo "<br />";
echo "<a href='uploadform.php'>go back</a>";
?>
</span>
</body>
</html>
Er der nogen som kan gennemskue, hvad jeg har gjort forkert?