PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ftell> <fseek
Last updated: Fri, 04 Jul 2008

view this page in

fstat

(PHP 4, PHP 5)

fstat — Obtiene información sobre un archivo usando un apuntador de archivo abierto

Descripción

array fstat ( resource $gestor )

Reúne las estadísticas del archivo abierto por el apuntador a archivo gestor . Esta función es similar a la función stat(), excepto que opera sobre un apuntador de archivo abierto en lugar de un nombre de archivo.

Lista de parámetros

gestor

A file system pointer resource that is typically created using fopen().

Valores retornados

Devuelve una matriz con las estadísticas del archivo; el formato de la matriz es descrito en la página del manual sobre stat().

Ejemplos

Example #1 Ejemplo de fstat()

<?php

// abrir un archivo
$da fopen("/etc/passwd""r");

// reunir estadísticas
$fstat fstat($da);

// cerrar el archivo
fclose($da);

// imprimir sólo la parte asociativa
print_r(array_slice($fstat13));

?>

El resultado del ejemplo seria algo similar a:

Array
(
    [dev] => 771
    [ino] => 488704
    [mode] => 33188
    [nlink] => 1
    [uid] => 0
    [gid] => 0
    [rdev] => 0
    [size] => 1114
    [atime] => 1061067181
    [mtime] => 1056136526
    [ctime] => 1056136526
    [blksize] => 4096
    [blocks] => 8
)

Notes

Note: Esta funcion no funcionara con ficheros remotos ya que el fichero a examinar tiene que estar disponible desde el sistema de ficheros del servidor.



add a note add a note User Contributed Notes
fstat
mordae at mordae dot net
29-Jan-2006 04:12
dom at dodgydom dot com wrote:
Best way i found was to open the url into $data and make a temporary file with the contents of $data then get the fstats on the temporary file :).

OMG why? The only thing that will remain is the file size. You also download up to 1G file, which probably is not what you want.

To get size use PHP's function filesize() with URL wrappers or ask yourself via HTTP.
sheran at comtrust dot co dot ae
22-Feb-2001 02:14
On Windows NT the typical array element names for the fstat function are:

dev
ino
mode
nlink
uid
gid
size
atime
mtime
ctime

ftell> <fseek
Last updated: Fri, 04 Jul 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites