简体   繁体   中英

Codeigniter invalid upload path

Guys below is given code and folder structure. Anyone can please help me why it appearing " The upload path does not appear to be valid. " error? How can I resolve this error?

Folder Structure

Application
System
Upload
    414208

Codeigniter Code:

$config['upload_path']          = './uploads/414208';
$config['allowed_types']        = 'gif|jpg|png';
$this->load->library('upload', $config);

your folder name is Upload and not uploads

use it like this

$config['upload_path'] = './Upload/414208/';

As your upload location is outside of your application folder, something like this should work:

$config['upload_path'] = realpath(dirname(__FILE__)). '/Uploads/414208/';

if you decide to move your upload location within your application folder, then you can use APPPATH instead of realpath. If you use APPPATH, please note that it will have a trailing slash where realpath doesn't.

In you config

$config['upload_path'] = './uploads/414208';

it seems it cannot find directory named "uploads", this might be case sensitive and as ive been seeing in your Folder Structure you have Upload directory. You might want to rename your upload directory from "Upload" to "uploads" or change config upload path to './Upload/414208'

您的文件夹名称是Upload并且您正在写'upload'U必须大写

这是因为您的文件夹名称是“ Upload”,并且您在upload_path中使用“ uploads”

$config['upload_path'] = './Upload/414208/';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM