Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.php > #19126

Re: Downloading strangeness: downloaded file has no content

From "J.O. Aho" <user@example.net>
Newsgroups comp.lang.php
Subject Re: Downloading strangeness: downloaded file has no content
Date 2022-10-02 12:14 +0200
Message-ID <jpt6jlFl2gaU2@mid.individual.net> (permalink)
References <jpr2e0Fn0j4U1@mid.individual.net> <jpr993Fl2gbU1@mid.individual.net> <jprjkeFpihiU1@mid.individual.net>

Show all headers | View raw


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

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Downloading strangeness: downloaded file has no content Tim Streater <timstreater@greenbee.net> - 2022-10-01 14:50 +0000
  Re: Downloading strangeness: downloaded file has no content "J.O. Aho" <user@example.net> - 2022-10-01 18:47 +0200
    Re: Downloading strangeness: downloaded file has no content Tim Streater <timstreater@greenbee.net> - 2022-10-01 19:44 +0000
      Re: Downloading strangeness: downloaded file has no content "J.O. Aho" <user@example.net> - 2022-10-02 00:18 +0200
      Re: Downloading strangeness: downloaded file has no content "J.O. Aho" <user@example.net> - 2022-10-02 12:14 +0200
        Re: Downloading strangeness: downloaded file has no content Tim Streater <timstreater@greenbee.net> - 2022-10-02 15:57 +0000
  Re: Downloading strangeness: downloaded file has no content Jerry Stuckle <stuckle.jerry@gmail.com> - 2022-10-01 12:57 -0400
    Re: Downloading strangeness: downloaded file has no content Tim Streater <timstreater@greenbee.net> - 2022-10-01 19:48 +0000
      Re: Downloading strangeness: downloaded file has no content Jerry Stuckle <stuckle.jerry@gmail.com> - 2022-10-01 19:13 -0400
        Re: Downloading strangeness: downloaded file has no content Tim Streater <timstreater@greenbee.net> - 2022-10-02 16:01 +0000

csiph-web