2012-07-30 235 views
3

我一直在試圖將圖像從表單移動到我的網站上由godaddy託管的上傳文件夾。當使用move_uploaded_file()方法時,我得到一個權限被拒絕的錯誤。我在這個問題上經歷了不少問題,但他們都沒有解決我的問題。另外,我已經改變了我的權限爲777PHP move_uploaded_file權限被拒絕

這是我一直得到錯誤:

警告:move_uploaded_file()以[function.move上傳文件]:無法 招'd:\ TEMP \ PHP中\ php42C0.tmp' 在 d到 '上傳/ vZvD6WI4vkapbCLovWtrSIG3xPLD0E.jpeg':\主機\ 11111 \ HTML \ DIR \ upload_image \ formsubmit.php線80上

PHP代碼:

$name = $_POST['name']; 
$email = $_POST['email']; 

if(isEmpty($name) || isEmpty($email)) { 
    print '<b>Please go back to the previous page and fill out your name.</b>'; 
} 
else { 

$file_name = "file1"; 
    if ((($_FILES[$file_name]["type"] == "image/gif") 
    || ($_FILES[$file_name]["type"] == "image/jpeg") 
    || ($_FILES[$file_name]["type"] == "image/jpg") 
    || ($_FILES[$file_name]["type"] == "image/bmp") 
    || ($_FILES[$file_name]["type"] == "image/tiff") 
    || ($_FILES[$file_name]["type"] == "image/png") 
    || ($_FILES[$file_name]["type"] == "image/pjpeg")) 
    && (($_FILES[$file_name]["size"] < 10000000) && $_FILES[$file_name]["size"] > 0)) 
    { 
     if ($_FILES[$file_name]["error"] > 0) 
     { 
      print "There was an error in uploading your images: " . $_FILES[$file_name]["error"] . "<br />"; 
     } 
     else 
     { 
      if (file_exists("upload/" . $rand_img_name.".jpeg")) 
      { 
       print "Please try uploading your image again<br />"; 
      } 
      else 
      { 
       move_uploaded_file($_FILES[$file_name]["tmp_name"], 
       "upload" ."/". $rand_img_name.".jpeg"); 
       $files_are_valid[($i-1)] = true; 
      } 
     } 
    } 
    else 
    { 
     print 'Image must be a valid image under 10 MB (Make sure you submitted an image)<br />'; 
     $files_are_valid[($i-1)] = false; 
    } 
} 

if($files_are_valid[0] == true) { 
    $all_valid = true; 
} 
else { 
    $all_valid = false; 
} 

回答