开发者

Apache error Directory index forbidden by rule

开发者 https://www.devze.com 2023-02-24 20:31 出处:网络
I am getting the following error: Directory index forbidden by rule: /Users/User/Desktop/Local/House/includes/uploads/gallery/, referer: http://house.dev.local/admin/deleteimage

I am getting the following error:

 Directory index forbidden by rule: /Users/User/Desktop/Local/House/includes/uploads/gallery/, referer: http://house.dev.local/admin/deleteimage

.htaccess

# Customized error messages.
 ErrorDocument 404 /index.php

 # Set the default handler.
DirectoryIndex index.php

# Various rewrite rules.
 <IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond $1 !^(index\.php|css|js|images|files|scripts|robots\.txt)
 RewriteRule ^(.*)$ index.php/$1 [L,QSA]
 </IfModule> 

Delete Image

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Addimage extends CI_Controller { 

function __construct(){ 
parent::__construct(); 
} 
function index() { 
if(!$this->session->userdata('logged_in')) { 
    redirect('admin/home'); 
} 
// Main Page Data 
$data['cms_pages'] = $this->navigation_model->getCMSPages(); 
$data['title'] = 'Add Gallery Image'; 
$data['content'] = $this->load->view('admin/addimage',NULL,TRUE); 

$this->load->view('admintemplate', $data); 

//Set Validation 
//$this->form_validation->set_rules('userfile', 'userfile', 'trim|required'); 
$this->form_validation->set_rules('description', 'Description', 'trim|required'); 

if($this->form_validation->run() === TRUE) { 

//Set File Settings 
$config['upload_path'] = 'includes/uploads/gallery/'; 
$config['allowed_types'] = 'jpg|png'; 
$config['remove_spaces'] = TRUE;
$config['overwrite'] = TRUE;
$config['max_size'] = '100'; 
$config['max_width'] = '1024'; 
$config['max_height'] = '768'; 

$this->load->library('upload', $config);
if(!$this->upload->do_upload()) {

$error = array('imageError' => $this->upload->display_errors());
}
else{
$data = array('upload_data' => $this->upload->data());
$config['image_library'] = 'GD2';
$config['source_image'] = $this->upload->upload_path.$this->upload->file_name;
$config['new_image'] = 'includes/uploads/gallery/thumbs/';
$config['create_thumb'] = 'TRUE';
$config['thumb_marker'] ='_thumb';
$config['maintain_r开发者_StackOverflow社区atio'] = 'FALSE';
$config['width'] = '200';
$config['height'] = '150';

$this->load->library('image_lib', $config);
$this->image_lib->resize();
}

$file_info = $this->upload->data();

$data = array(   
    'description' => $this->input->post('description', TRUE), 
    'fullpath' => $file_info['file_name'],
'thumbpath' =>$file_info['raw_name'].'_thumb'.$file_info['file_ext'] 
    ); 
$this->image_model->addImage($data);

$this->data['success'] = 'Thank You, Your Image Has Been Uploaded';
} 
 } 

 }


I fixed this issue, I had mac web sharing on which I had forgotten about

0

精彩评论

暂无评论...
验证码 换一张
取 消