我得到以下错误,我不知道为什么。上传脚本中的未定义变量
说明:未定义指数:上传在C:\ XAMPP \ htdocs中\在线网站\ upload.php的3
说明:未定义变量:uploaded_size在C:\ XAMPP \ htdocs中\站点\ upload.php的第7行
说明:未定义变量:uploaded_type在C:\ XAMPP \ htdocs中\在线网站\ upload.php的14
说明:未定义指数:上传在C:\ XAMPP \ htdocs中\站点\上传.php 29行
我试图在本文中包含php的源代码,但不能。 这里是链接引擎收录:My source code
<?php
$target = "upload/";
$target = $target . basename($_FILES['uploaded']['name']) ;
$ok=1;
//This is our size condition
if ($uploaded_size > 350000)
{
echo "Your file is too large.<br>";
$ok=0;
}
//This is our limit file type condition
if ($uploaded_type =="text/php")
{
echo "No PHP files<br>";
$ok=0;
}
//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}
//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename($_FILES['uploadedfile']['name']). " has been uploaded";
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>
编辑1:我从about.com代码about.com
一切都是正确的。我从about.com得到了代码。我在第一篇文章中附加了链接。请你可以检查一下。 – andrew 2012-08-17 17:13:31
本教程写得不好,缺少代码。这是不正确的,因为你从别人那里复制它。 – 2012-08-18 16:30:35
我发现了另一个教程。认为这是对的,因为它来自这样一个大网站about.com,但显然它不是。谢谢 – andrew 2012-08-18 19:13:41