Welcome Guest, Not a member yet? Register   Sign In
codeigniter 3 file upload not working on iis
#1

(This post was last modified: 09-10-2019, 04:13 AM by tp45.)

Hello 
Am running codeigniter 3 on iis  so am trying to upload an image but it is not uploading and it is not giving an error, but when i post text it works
here is my upload code:

PHP Code:
public function post(){

        
  if (empty($this->input->post('post_text')) && empty($_FILES['image']['name'])) {
            
redirect('posts');
        
  }

        
  $config['upload_path'] = './assets/images/postimages';
          $config['allowed_types'] = 'gif|jpg|png|jpeg';
          $config['max_size'] = '2048';

          $this->load->library('upload'$config);



          if (!empty($_FILES['image']['name'])) {

              if ($this->upload->do_upload('image')) {
                  $post_image $_FILES['image']['name'];
        
        if ($this->Post_model->addPost($post_image)) {
        
          array('upload_data' => $this->upload->data());
        
          redirect('posts');
        
        }else{
        
          $this->session->set_flashdata('post_errors''Sorry something went wrong, Please try again');
        
          redirect('posts');
        
        }
            }else{
            
//to diagnose i put else  here and put redirect function
              
redirect('posts');
              
//so i try to upload an image it always come to else, if i remove else and submit the form it just go to the url and stops
              
like it go here http://localhost/friendmiiDemo/posts/post and stop
           
}
            

          }else{
              if ($this->Post_model->addPost()) {
    
          redirect('posts');
        
    }else{
    
          $this->session->set_flashdata('post_errors''Sorry something went wrong, Please try again');
    
          redirect('posts');
        
    }
          }



on xampp it works great but on iis does not work
i dont know the problem please help
Thanks in advance
Reply


Messages In This Thread
codeigniter 3 file upload not working on iis - by tp45 - 09-10-2019, 04:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB