| 
 Posted by Barry on 09/07/05 13:36 
hi 
 
don't rely on $_FILES['name']['type'] as php relies on the browser to  
supply this. 
here's a function from the contrib notes: 
 
if (!function_exists('mime_content_type')) { 
  	function mime_content_type($f) { 
     	$f = escapeshellarg($f); 
        	return trim( `file -bi $f` ); 
    	} 
} 
 
have you moved the uploaded file yet? 
the path to the actual file is being kept in $_FILES['name']['tmp_name'] 
so your 1st piece of code shouldn't work. 
 
Iced Milk Tea wrote: 
> I am trying to program a upload system. 
>  
> The following code work very fine, 
>  
> $file_name = $_FILES['uploadFile'. $x]['name']; 
> $size = filesize($file_name); 
> $type = mime_content_type($file_name); 
>  
> However, when I change to 
>  
> $file_name = $_FILES['uploadFile'. $x]['name']; 
> $size = $_FILES['uploadFile'. $x]['size']; 
> $type = $_FILES['uploadFile'. $x]['type']; 
>  
> The program fail to give me any result. 
>  
> Is there any problem happan in my code? 
>  
> Thanks in advance for your advice. 
>
 
  
Navigation:
[Reply to this message] 
 |