Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    [php] domanda stupidissima sui tipi di file...

    ciao a tutti...

    ho un problema stupido: come faccio a determinare il tipo di un file non uploadato e che non sia un'immagine?!

    ho provato con echo mime_content_type($file);
    ma
    Fatal error: Call to undefined function: mime_content_type() in c:\programmi\apache group\apache\test\script\dirtree.php on line 28

    devo farmi le ricerche sulla stringa op. ho un'istruzione apposta?

    spero in un aiuto, grazie,
    r@p

  2. #2
    up!

  3. #3
    hai provato ad usare pathinfo()?
    ti ritorna anche l'estensione se è la path di un file.

    Eventualmente se sei su linux puoi tentare con un
    $result = system ( "file $nomefile" );
    In a world without walls and fences - who needs windows and gates ?

  4. #4
    uhm... grazie per la risposta ma:

    - pathinfo() non è quello che mi serve
    - non uso linux aihmè


    io devo fare questo:

    ho già dentro un array una lista di files; me lo scorro e stampando ottengo questo output:

    c:/programmi/apache group/apache/test/maya/music/mp3/Ben Harper/Ben Harper - Fight for Your Mind - 03 - Another Lonely Day.mp3
    c:/programmi/apache group/apache/test/maya/music/mp3/Ben Harper/Ben Harper - Fight for Your Mind - 07 - Excuse Me Mr.mp3
    c:/programmi/apache group/apache/test/maya/music/mp3/Ben Harper/Ben Harper - Fight for Your Mind - 09 - Fight For Your Mind.mp3

    in pratica devo fare un chk che mi dica se il file è mp3 oppure non lo è


    grazie,

    r@p

  5. #5
    per intenderci


    io ho fatto così:

    codice:
    foreach($music_array as $song){
    	if(filetype($song) == 'file')
    		if (substr($song, -4) == '.mp3')
    			echo $song."
    \n";

    FUNZIONA, ma non mi sembra il modo migliore... o meglio, un bel modo!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.