PHP filesize() 2GB limitation
Because PHP's integer type is signed and many platforms use 32bit integers, filesize() may return unexpected results for files which are larger than 2GB. We currently have a workaround function large_filesize() which parses the filesystem on linux systems, but can fail on systems that can't use 'exec'. On Windows systems this is still limited to 2GB.
An alternative method would be to use get_headers() and let the file server determine the Content-Length and parse the header for the size.
The SwissCenter database currently stores the filesize as INT which is also limited to 2GB so will also need converting to BIGINT.
An alternative method would be to use get_headers() and let the file server determine the Content-Length and parse the header for the size.
The SwissCenter database currently stores the filesize as INT which is also limited to 2GB so will also need converting to BIGINT.
Leave a comment
(in revision:1507) Updated the function large_filesize() to parse the Content-Length after using get_headers() on the file. This is a workaround as filesize() fails on files over 2GB using 32bit PHP binaries. Refs* 248
(In revision:1508) The filesize now stored in the database is that obtained by GetID3. Refs* 248