2017-06-14 18 views
1

請幫忙圖像不能在服務器上載,我 PHP代碼: -webrivers - 我無法在服務器上傳圖片?

$gallery_image = $_FILES['image'] ['name']; 
    $image_tmp = $_FILES['image'] ['tmp_name']; 
    move_uploaded_file($image_tmp, "../extra_images/$gallery_image"); 

我的錯誤是: -

PHP Warning: move_uploaded_file(../extra_images/brand-04.jpg): failed to open stream: Permission denied in G:\PleskVhosts\luisant.in\vethathirimaharishischool.org\admin\gallery.php on line 129 
PHP Warning: move_uploaded_file(): Unable to move 'C:\Windows\Temp\php4118.tmp' to '../extra_images/brand-04.jpg' in G:\PleskVhosts\luisant.in\vethathirimaharishischool.org\admin\gallery.php on line 129 
+2

'在G:\ PleskVhosts \ luisant.in \ vethathirimaharishischool.org \ admin \ gallery中拒絕了權限。 php on line 129' 你有權限寫tmp文件夾嗎? – marmeladze

+1

錯誤清楚地顯示,有權限問題 –

+0

對不起,我不明白。, –

回答

0

的錯誤是自我解釋:

failed to open stream: Permission denied on "../extra_images/" 

你不對上面列出的目錄沒有寫入權限。提供寫入權限並重試。

0

您沒有目錄的權限。

要改變這是/extra_images

目標目錄的所有者和權限試試這個命令:

  1. chown user /extra_images
  2. chmod 755 /extra_images
0

這是因爲圖像和tmp_file_upload只可由root用戶寫入。對於上傳工作,我們需要使這些文件夾的所有者與httpd進程所有者相同或使它們成爲全局可寫。learn more>>

+0

感謝所有工作的完美。 –