PHPEdit.net Community
   
1 2 3 4
Tutorials Tips Pasties Code Snippets
 

Home > Pasties > Pastie #10

Created on 28/02/2008 11:40 by LEGLISE CHARLES EDOUARD

  1. //vérification d'extention
  2.  
  3. function checkExtention( $file){
  4. $file = 'myfile.rar';
  5. $ext_Array = array("zip","rar","jpg","jpeg","gif","bmp");
  6.  
  7. // Check file
  8. if ( file_exists($file)) {
  9. $file_Ext = explode('.',$file); // Explode the extention
  10. $file_Ext = strtolower($file_Ext[1]); // Modify case
  11. return (in_array($file_Ext,$ext_Array))? true:false;
  12. }
  13. }
  14.  
  15. checkExtention( 'test.rar')

 
PHPEdit User Community, © 2008 WaterProof SARL
Powered by PHPEdit