【发布时间】:2012-08-17 16:58:46
【问题描述】:
我得到以下错误,我不知道为什么。
注意:未定义索引:在第 3 行的 C:\xampp\htdocs\site\upload.php 中上传
注意:未定义变量:第 7 行 C:\xampp\htdocs\site\upload.php 中的上传大小
注意:未定义变量:第 14 行 C:\xampp\htdocs\site\upload.php 中的上传类型
注意:未定义索引:在第 29 行的 C:\xampp\htdocs\site\upload.php 中上传
我试图在这篇文章中包含 php 的源代码,但不能。 这是 pastebin 的链接: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 获得代码
【问题讨论】:
标签: php variables upload undefined