Page 302 - CITS - CSA - TP (Volume 1) - Hindi
P. 302

कंप्यूटर सॉफ्टवेयर एप्लीकेशन- CITS




                         $fileName = ‘my_new_file.txt ;

                         //  Check if the file exists

                         if (file_exists($fileName))
                         {

                                 // Get the file size in bytes

                                 $fileSizeBytes = filesize($fileName);
                                 //  Convert the file size to kilobytes or megabytes

                                 $fileSizeKB = $fileSizeBytes / 1024; // Bytes to Kilobytes

                                 $fileSizeMB = $fileSizeKB / 1024;    // Kilobytes to Megabytes
                                 //  Display the file size

                                 echo “File ‘$fileName  has a size of $fileSizeBytes bytes,          $fileSizeKB
              KB, or $fileSizeMB MB.”;

                         }

                         else
                         {

                                 // Display an error message if the file does not exist

                                 echo “Error: File ‘$fileName  does not exist.”;

                         }
                   ?>

                     </body>

                             </html>
           3   ो ाम को C:\Apache24\htdocs म  .php ए ट शन वाले फ़ो र म  सेव कर

           4  Apache सिव स को िवंडोज़ सिव स से रन कर

           5   ाउज़र ओपन कर  और िन  एड ेस टाइप कर
              http://localhost/foldername/
           6  रन करने के  िलए php फ़ाइल पर   क कर  और आउटपुट को वेरीफाई कर





















                                                           286

                                       CITS : IT & ITES - कं  ूटर सॉ वेयर ए ीके शन - अ ास 55
   297   298   299   300   301   302   303   304   305   306   307