Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!