private function setMimeType($file, $index = 0) {
		if(count($this->uploaded) <= $index) {
    		error_log('index out of bounds');
    		return false; 
    	}
		
		if(function_exists('finfo_open')) {
			//use Fileinfo extension
			
			//use Fileinfo extension
			//$finfo = finfo_open(FILEINFO_MIME, MAGIC_FILE);
			
			//use this for newer versions of php 5.3
			$finfo = finfo_open(FILEINFO_MIME_TYPE);
			
			if(!$finfo) {
  				error_log('finfo can\'t read mime db');
  			} else {
   				$info = finfo_file($finfo, $file);
   				finfo_close($finfo);
   				//magic db might provide extra information after mime type, so strip that out
   				$typeInfo = explode(';', $info);
   				$this->uploaded[$index]['type'] = $typeInfo[0];
   				
   				return $typeInfo[0];
  			}
		}
		
		return false;
	}
private function setMimeType($file, $index = 0) {
		if(count($this->uploaded) <= $index) {
    		error_log('index out of bounds');
    		return false; 
    	}
		
		if(function_exists('finfo_open')) {
			//use Fileinfo extension
			
			//use Fileinfo extension
			//$finfo = finfo_open(FILEINFO_MIME, MAGIC_FILE);
			
			//use this for newer versions of php 5.3
			$finfo = finfo_open(FILEINFO_MIME_TYPE);
			
			if(!$finfo) {
  				error_log('finfo can\'t read mime db');
  			} else {
   				$info = finfo_file($finfo, $file);
   				finfo_close($finfo);
   				//magic db might provide extra information after mime type, so strip that out
   				$typeInfo = explode(';', $info);
   				$this->uploaded[$index]['type'] = $typeInfo[0];
   				
   				return $typeInfo[0];
  			}
		}
		
		return false;
	}
private function setMimeType ( $ file , $ index = 0 ) { if ( count ( $ this -> uploaded ) <= $ index ) { error_log ( 'index out of bounds' ) ; return false ; } if ( function_exists ( 'finfo_open' ) ) { //use Fileinfo extension //use Fileinfo extension //$finfo = finfo_open(FILEINFO_MIME, MAGIC_FILE); //use this for newer versions of php 5.3 $ finfo = finfo_open ( FILEINFO_MIME_TYPE ) ; if ( ! $ finfo ) { error_log ( 'finfo can\'t read mime db' ) ; } else { $ info = finfo_file ( $ finfo , $ file ) ; finfo_close ( $ finfo ) ; //magic db might provide extra information after mime type, so strip that out $ typeInfo = explode ( ';' , $ info ) ; $ this -> uploaded [ $ index ] [ 'type' ] = $ typeInfo [ 0 ] ; return $ typeInfo [ 0 ] ; } } return false ; }
Determine the mime type of the uploaded file.
The browser provides a mime type when the file is uploaded, but it is not a reliable source.

@param string $file - the full path to the file
@param integer $index
Determine the mime type of the uploaded file . The browser provides a mime type when the file is uploaded but it is not a reliable source .