• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI3.1.7 Upload Image Sometime Failed

#1
Hello,

I found some strange thing.
I have two images, but I can only upload one of them.
https://ibb.co/j1U0yb

I can upload 456.jpg,
but I can't upload 123.jpg (it will upload noimage.jpg instead)

This is my controller's code
PHP Code:
$config['upload_path'] = './assets/images/event/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '2048';
$config['max_width'] = '1500';
$config['max_height'] = '1500';
$config['remove_spaces'] = FALSE;

$this->load->library('upload'$config);
if(!
$this->upload->do_upload('userfile')){
 
 $errors = array('error'=> $this->upload->display_errors());
 
 $post_image 'noimage.jpg';
}else{
 
 $data = array('upload_data' => $this->upload->data());
 
 $post_image $_FILES['userfile']['name'];
}
$this->Event->create_events($post_image);
$this->session->set_flashdata('event_created','Your event has been created');
redirect('events'); 
Anyone have idea?

Thank you very much in advance.


Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
CI3.1.7 Upload Image Sometime Failed - by forfunonly - 01-22-2018, 03:55 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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