Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get upload error codeigniter

if($this->input->post())
{
   $file_element_name = 'image';  //this is the name of your input file. for example "image"
   if ($_FILES['image']['name']!= "")
   {
      $config['upload_path'] = './uploads/';
      $config['allowed_types'] = 'gif|jpg|png|exe|xls|doc|docx|xlsx|rar|zip';
      $config['max_size']      = '8192'; 
      $config['remove_spaces']=TRUE;  //it will remove all spaces
      $config['encrypt_name']=TRUE;   //it wil encrypte the original file name
      $this->load->library('upload', $config);

      if (!$this->upload->do_upload($file_element_name))
      {
         $error = array('error' => $this->upload->display_errors());
         $this->session->set_flashdata('error',$error['error']);
         redirect('controller_name/function_name','refresh');
      }
      else
      {
         $data = $this->upload->data();
         return $data['file_name'];          
      }
      $this->session->set_flashdata('msg','success message');
      redirect('controller_name/function_name','refresh');
   }
   else
   {
        //if no file uploaded the do stuff here
   } 
}
Comment

PREVIOUS NEXT
Code Example
Php :: laravel migration remove column 
Php :: add 7 days to date php 
Php :: string contains php 
Php :: carbon diffForHumans 
Php :: compare hashed password and a unhashed password in laravel 
Php :: foreach empty laravel 
Php :: php round down 
Php :: remove comma in numeric in php 
Php :: foreign id laravel migration 
Php :: php convert degrees to radians 
Php :: laravel long description text string 
Php :: is number divisible by 3 php 
Php :: display category name wordpress 
Php :: get data in orderby in laravel 
Php :: get user ip laravel 
Php :: php compare string 
Php :: laravel session has message 
Php :: ian holm 
Php :: how to allow cors through header in php 
Php :: php json_encode encode not escape forward slash 
Php :: diffforhumans laravel 
Php :: integer default value laravel 
Php :: in random order laravel 
Php :: laravel carbon count days between dates 
Php :: define url wordpress 
Php :: composer require laravel/ui not working laravel 7 
Php :: highlight search text in php 
Php :: for install perticular version in vue with laravel 
Php :: how to print array in laravel blade 
Php :: carbon time ago laravel 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =