Resets a directory stream.
This function resets the directory pointer so that readdir() returns the first entry again.
<?php
$dh = opendir("upload");
$file = readdir($dh);
print "[$file]<br>";
rewinddir($dh);
$file = readdir($dh);
print "[$file]";
?> [.]
[.] Using rewinddir(), the pointer is reset so that the first entry of the directory is read twice.