Re: Downloading strangeness: downloaded file has no content

"J.O. Aho" <[email protected]>
Newsgroups comp.lang.php
Message-ID <[email protected]>
On 01/10/2022 21.44, Tim Streater wrote:

>>> ob_clean ();

This will just clean out the output buffer, so the max size would then 
be limited of the buffer size, think you need to switch to use 
ob_end_clean() which disables the output buffer and is recommended in 
the php documentation for readfile.


>>> readfile ($file);

By the way, what value does the redfile return?
Also do you get an exception?
Could also be got to check the file exists and can be read

If(file_exists($file))  is_file($file))
{
	if(is_file($file)) {
		if(is_readable($file)) {
			try {
				$retval =  readfile ($file);
				// log the retval to your logfile
			} catch (Exception $ex) {
				//log the exception here
			}
		} else {
			// log that file not readable
		}
	} else {
		// log file not really a file, most likely a directory
	}
} else {
	// log the file do not exists
}


-- 

  //Aho
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.