Jump to content


Photo

help getting filetype


  • Please log in to reply
2 replies to this topic

#1 jvrothjr

jvrothjr
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts
  • LocationOhio

Posted 12 September 2006 - 02:48 PM

My question here is I need to know the file type of file list from a directory and feed to the is function all its telling me is file or dir and I need to know image or text type.

Can some one help with this.

basiclly getting revision of files listed under root directory of server just need to know the type of file it is..................

Function Setrecloop($form_data){
// Set variable of file data        
       	$Filesize = filesize($form_data);
	$Filetype = filetype($form_data); 
}

If you understand everything you know nothing!

http://rcchjr.awardspace.com/

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 12 September 2006 - 07:59 PM

you might want to look at

http://www.php.net/mime_content_type
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 jvrothjr

jvrothjr
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts
  • LocationOhio

Posted 13 September 2006 - 02:02 PM

I have added both mime and filetype and neither one works

I have enabled mine in php.ini and added <?php to magic.mime file

using the below function and still getting nothing but [file]

anyother Ideas Please

Function Setrecloop($dirpath,$form_data){

	$filepath = $dirpath."/".$form_data;

   	$data = addslashes(fread(fopen($filepath, "r"), filesize($filepath)));

   	$filepath_size = filesize($filepath);

	echo mime_content_type($filepath)." Testing filepath</p>";
	echo filetype($filepath)." Testing filepath</p>";

	echo mime_content_type($form_data)." Testing form_data</p>";
	echo filetype($form_data)." Testing form_data</p>";

	echo mime_content_type($data)." Testing data</p>";
	echo filetype($data)." Testing data</p>";
}

If you understand everything you know nothing!

http://rcchjr.awardspace.com/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users