User Tools

Site Tools


uphp:functions:filesize

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
uphp:functions:filesize [2017/04/05 14:07]
jeff
uphp:functions:filesize [2021/09/13 05:57] (current)
Line 11: Line 11:
 **Filename Form** - The syntax is the same as in mainline PHP, and uses a filename for the parameter: **Filename Form** - The syntax is the same as in mainline PHP, and uses a filename for the parameter:
  
-<well size="sm"><html><span style="font-size:125%;color:green">int +<well size="sm"><html> 
-<span style="color:black"></html>[[filesize]] +<span style="font-size:125%;color:green">int 
-<html>(+<span style="color:black">filesize (
 <span style="color:green">string <span style="color:green">string
 <span style="color:blue">$filename <span style="color:blue">$filename
Line 19: Line 19:
 </html></well> </html></well>
  
-**Handle Form** - The syntax is unique to uPHP,((The Handle Form is more commonly used on the Wattmon. Compared to mainline PHP, this uPHP form is a much simpler method for retrieving the number of bytes pending in a stream. For examples of how much more complex mainline PHP can be, take a look at the PHP function [[http://php.net/manual/en/function.stream-get-meta-data.php|stream-get-meta-data]] which returns an <html><b><span style="color:green">array<span style="color:black"></b></html> with one of the elements containing 'unread_bytes'.)) and uses an open resource handle for the parameter (which works with streams, sockets, ports and files):+**Handle Form** - The syntax is unique to uPHP,((The Handle Form is more commonly used on the [[hardware:wattmons|Wattmon]]. Compared to mainline PHP, this uPHP form is a much simpler method for retrieving the number of bytes pending in a stream. For examples of how much more complex mainline PHP can be, take a look at the PHP function [[http://php.net/manual/en/function.stream-get-meta-data.php|stream-get-meta-data]] which returns an <html><b><span style="color:green">array<span style="color:black"></b></html> with one of the elements containing 'unread_bytes'.)) and uses an open resource handle for the parameter (which works with streams, sockets, ports and files):
  
-<well size="sm"><html><span style="font-size:125%;color:green">int +<well size="sm"><html> 
-<span style="color:black"></html>[[filesize]] +<span style="font-size:125%;color:green">int 
-<html>(+<span style="color:black">filesize (
 <span style="color:green">int <span style="color:green">int
 <span style="color:blue">$handle <span style="color:blue">$handle
Line 37: Line 37:
 <html><b><span style="color:blue">$handle<span style="color:black"></b></html>:  Valid handle of a previously opened resource (Handle Form) <html><b><span style="color:blue">$handle<span style="color:black"></b></html>:  Valid handle of a previously opened resource (Handle Form)
  
-====Return Value====+====Return Values====
  
-Bytes in the file or pending in the stream or socket+<html><b><span style="color:green">Integer<span style="color:black"></b></html> number of bytes in the fileor pending in the stream or socket
  
 ====Examples==== ====Examples====
  
-**Filename Form, output the size of the System Log:**+===Filename Form, output the size of the System Log===
  
 <code php> <code php>
Line 52: Line 52:
 </code> </code>
  
-**Handle Form, for a file, output the file size:**+===Handle Form, for a file, output the file size===
  
 <code php> <code php>
Line 63: Line 63:
 ?></code> ?></code>
  
-**Handle Form, for a socket** - this example is extracted from the Wattmon OS "/scripts/ip_dongle.cgi":+===Handle Form, for a socket=== 
 + 
 +This example is extracted from the Wattmon OS "/scripts/ip_dongle.cgi":
  
 <code php> <code php>
Line 107: Line 109:
 [[file_exists()]] - Check if a file exists [[file_exists()]] - Check if a file exists
  
-[[ini_get()]] - Return the value associated with the key if it exists, or the default value otherwise+[[ini_get()]] - Get a value from an INI file
  
  
uphp/functions/filesize.1491401261.txt.gz · Last modified: 2021/09/13 05:56 (external edit)