class instantiating error on live server

See all posts Reply

class instantiating error on live server new!
by Cyber Pk, 10 years, 9 months ago
hi,

i am using this class to uploaded multiple images, working perfect on local server with php 5.4 but causing trouble on liver testing server. funny thing is when i just put the code in a simple folder it works fine. but when i integrate it in my project it gives error (HTTP Error 500). looks like its breaking on class instantiating(working smoothly on local and also works on live server when put in separate folder ) below is my code, appreciate any help

$files = array();
foreach ($_FILES['item_image'] as $k => $l) {
  foreach ($l as $i => $v) {
    if ( !array_key_exists($i, $files) )
      $files[$i] = array();
    $files[$i][$k] = $v;
	}
}

//print_r($files);  exit();
foreach ( $files as $file ) {
  if(!empty($file['name'])){			
    $largeUpload 		= 'up/large/';
    $thumbUpload 		= 'up/thumbs/';			
    $imgArr[] = $this->processImages( $file, $largeUpload, $thumbUpload );		
  }
}

function processImages( $file, $pathLarge, $pathThumb ){
  $handle = new Upload($file);
  if ($handle->uploaded) {
    $handle->mime_check           = false;
    $handle->mime_magic_check     = false;

    /* Large */
    $handle->file_new_name_body   = $handle->file_src_name_body;
    if( $handle->image_src_x > 1200 ){
      $handle->image_resize         = true;
      $handle->image_x              = 1200;
      $handle->image_ratio_y        = true;
    }
    $handle->process($pathLarge);
				
    /* Thumnail */
    $handle->file_new_name_body   = $handle->file_src_name_body;
    $handle->image_resize         = true;
    $handle->image_x              = 150;
    $handle->image_ratio_y        = true;
    $handle->process($pathThumb);

    if ($handle->processed) {			
      return $handle->file_dst_name;				  
      $handle->clean();
    } else {
      return 'error : ' . $handle->error;
    }
  }
}
Reply
Re: class instantiating error on live server new!
by colin, 10 years, 9 months ago
Check you web server log, it will give you more details about the 500 error.Reply
Re: class instantiating error on live server new!
by Cyber Pk, 10 years, 9 months ago
@ colin

Thanks for response!!!Reply
Re: class instantiating error on live server new!
by Cyber Pk, 10 years, 9 months ago
update :

issue solved seems like mime_content_type was causing the trouble

fix = disabled mime detection methods in upload class init() function

$this->mime_fileinfo            = false;
$this->mime_file                = false;
$this->mime_magic               = false; 
$this->mime_getimagesize        = true;


cheers :)Reply