Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

163
Vistas
how to find the length of the text file which user uploads

Guide me to find the number of characters which are present in the text file which i upload. This code will display the characters which are present in the .txt file`

<!DOCTYPE html>
<html>
    <head>
        <title>File Reader</title>
    </head>
    <body>
        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
            <input type="file" name="file" size="60" accept=".txt" />
            <input type="submit" value="Show Contents" />
        </form>
        <?php
            if ($_FILES) {

                    $fileName = $_FILES['file']['tmp_name'];

                    $file = fopen($fileName, "r");

                    while (!feof($file)) {
                        echo fgets($file) . "";
                    }

                    while (!feof($file)) {
                        echo fgetc($file);
                    }
                    fclose($file);
                }
        ?>
    </body>
</html>
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You could use

$_FILES['userfile']['size']

this give you the size, in bytes, of the uploaded file.

http://www.php.net/manual/en/features.file-upload.post-method.php

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda