• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
image upload on local is fine but not working on live server

#1
Hi All,


I am trying to create a code for image uploading it's perfectly working on localhost but live server it's not working and not showing any error( CI version 3.1.2 ).

I have given 777 permission to the folder.

code:

View File:

<html>
 
   <head> 
      <title>Upload Form</title> 
   </head>

   <body> 
      <?php echo $error;?> 
      <?php echo form_open_multipart('upload/do_upload');?> 

      <form action = "" method = "">
         <input type = "file" name = "userfile" size = "20" /> 
         <br /><br /> 
         <input type = "submit" value = "upload" /> 
      </form> 

   </body>

</html> 

Controller: 


<?php
  
   class Upload extends CI_Controller {

      public function __construct() { 
         parent::__construct(); 
         $this->load->helper(array('form', 'url')); 
      }

      public function index() { 
         $this->load->view('upload_form', array('error' => ' ' )); 
      } 

      public function do_upload() { 
      
      echo '<pre>';
     print_R($_FILES);
      
         $config['upload_path']   = './assets/image/'; 
         $config['allowed_types'] = 'gif|jpg|png'; 
         $config['max_size']      = 1000000000000; 
         $config['max_width']     = 1024000000000; 
         $config['max_height']    = 76800000000;  
         $this->load->library('upload', $config);
echo $this->upload->display_errors(); 
         if ( ! $this->upload->do_upload('userfile')) {
            $error = array('error' => $this->upload->display_errors()); 
          //  $this->load->view('upload_form', $error); 
            print_r($error); //debug it here 
         }

         else { 
            $data = array('upload_data' => $this->upload->data()); 
            $this->load->view('upload_success', $data); 
         } 
      } 
   } 
?>
Reply


Messages In This Thread
image upload on local is fine but not working on live server - by ankur - 04-01-2017, 12:50 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.