1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Two way to see type of file

Discussion in 'PHP' started by piropeator, Jun 1, 2016.

  1. #1
    Hi. I have this:
    <!DOCTYPE html>
    <html lang="es">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
    </head>
    <body>
        <form name="cargar" action="VerTipoFileShow.php" method="POST" enctype="multipart/form-data">
                <input type="file" name="archivo" size="2"></input>
                <input type="submit" value="Cargar Archivo"></input>
        </form>   
    </body>
    </html>
    HTML:
    I want to see the type of file using $_FILES[] and using FINFO_FILE();
    <?php
    echo "Tipo usando FILES :".$_FILES['archivo']['type'];
    echo "<br/>";
    
    $finfo = finfo_open(FILEINFO_MIME_TYPE);
    $filename = $_FILES['archivo']['name'];
    
    echo "Tipo usando FINFO:".finfo_file($finfo, $filename);
    ?>
    PHP:
    But I get this message:
    Warning: finfo_file(file.ext): failed to open stream: No such file or directory in Show.php on line 8
    Code (markup):
    What is the problem?
    Note: fileinfo is enabled.
     
    Solved! View solution.
    piropeator, Jun 1, 2016 IP
  2. #2
    hdewantara, Jun 1, 2016 IP