Ins3t хотелось бы узнать, в каких это случаях stat() не будет работать? И где это вы увидели, что stat() будет возврашать -1. В мане описано, что -1 будет возвращено только для поля blksize и то не обязательно для винды той же самой.
DonKihot файловым системам нисколько не интересно, когда файл был создан. Они оперируют 3 временами, о которых нам например может рассказать ман:
Код:
The field st_atime is changed by file accesses, e.g. by execve(2), mknod(2), pipe(2), utime(2) and read(2) (of more than zero bytes).
Other routines, like mmap(2), may or may not update st_atime.
The field st_mtime is changed by file modifications, e.g. by mknod(2), truncate(2), utime(2) and write(2) (of more than zero bytes).
Moreover, st_mtime of a directory is changed by the creation or deletion of files in that directory. The st_mtime field is not changed
for changes in owner, group, hard link count, or mode.
The field st_ctime is changed by writing or by setting inode information (i.e., owner, group, link count, mode, etc.).
Таким образом. atime - изменяется при чтении файла, mtime - при записи в файл, ctime - при изменении аттрибутов. Однако тот же ман говорит:
PHP код:
Not all of the Linux filesystems implement all of the time fields. Some file system types allow mounting in such a way that file
accesses do not cause an update of the st_atime field. (See ‘noatime’ in mount(8).)
То есть на НЕКОТОРЫХ системах можно смотреть на atime как время создания файла, но всецело полагаться на это не стоит.
Если уж вам настолько критично именно создание файла, то либо создавайте в БД таблицу, с датой заливки файла, либо смотрите минимальную дату среди mtime, ctime и atime