2012-11-01 21 views
0

我正在使用codeigniter 2.1.2上傳類將文件上傳到hostgator上的遠程服務器。嘗試上傳文件時出現以下錯誤。在hostgator服務器上使用Codeigniter上傳類時的文件路徑invlalid

The upload path does not appear to be valid.

這是我的文件夾結構:

我的 - 附加域/

---- 進口(目標文件夾)

----應用/

--------控制器/

------------ upload_controller.php

在我的控制,我曾試圖把$ config [ 'upload_path'],包括設置不同的路徑

  1. /家/我-hostgator-的用戶名/的public_html /我 - 附加域文件夾/進口/」
  2. ../import/
  3. 我站點的URL /進口/

這些都不工作。我一定要設置文件夾「導入」的可寫入權限。

非常感謝嘗試使用

回答

0

realpath

$config['upload_path'] = realpath('import'); 

(建議導入文件夾是Web服務器的根文件夾下()

一個水平,index.php文件駐留
$config['upload_path'] = './import/'; 
+0

這對我不起作用。「導入」文件夾位於my-addon-domain-folder下,howe ver realpath將返回到我的控制器文件的路徑,在我的情況下將是「/ home/my-hostgator-username/public_html/my-addon-domain-folder/application/controllers。 – user1310312

+0

@ user1310312你檢查了這個:http://codeigniter.com/forums/viewthread/81679/ - 你確定你已經初始化配置... $ this-> upload-> initialize($ config); – jtheman

+0

我應用了$ config ['upload_path'] = realpath('/ home/my-hostgator-username/public_html/my-addon-domain-folder/import /')。它現在有效。非常感謝你指出。 – user1310312

相關問題