我得到以下錯誤,我不知道爲什麼。上傳腳本中的未定義變量
說明:未定義指數:上傳在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