• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Codeigniter upload path invalid on webserver but valid on local host

#2
[eluser]Dandy_andy[/eluser]
I seem to have resolved this permissions issue by running PHP as a CGI application and adding a quick function to check if a directory already exists or not. I think the system was failing because some directories existed. This is how I changed the controller code for anyone interested and it now works...

Code:
//check if image exists in directory with same string (unlikely but better safe than sorry!)
  if (file_exists($set_image_path.$string.'.jpeg')) {$string .= substr($this->session->userdata('username'), 0, 4);}
  
  
  //check first if directory exists
  if (is_dir($set_image_path) == false)
   {
   mkdir($set_image_path, 0755, true);
   //echo 'created a new directory';
   }
  //echo 'nothing created';
  //exit();
  $config['upload_path'] = $set_image_path;
  $config['allowed_types'] = 'gif|jpg|jpeg|png';
  $config['max_size'] = '4000';
  $config['max_width'] = '6000';
  $config['max_height'] = '4000';
  $config['file_name'] = $string.'.jpeg';  
  $this->load->library('upload', $config);


Messages In This Thread
Codeigniter upload path invalid on webserver but valid on local host - by El Forum - 09-23-2012, 01:52 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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