internet explorer - Sporadic error downloading data from PHP application -


a php application offering binary data download:

header("content-type: application/octet-stream");        header("pragma: public"); header("cache-control: private");    header("content-disposition: attachment; filename=\"$filename\""); header("expires: 0");       set_time_limit(0); ob_clean(); flush();     @readfile($completefilename); exit; 

$completefilename stream "ftp://user:pwd@..."

the size of data can several mbyte. works fine, sporadically following error:

error

it's remote stream down, or times out.

also @fab says file trying load larger script's memory.

you should start logging errors readfile() returns, e.g. using error_log php.ini directive.

if needs foolproof, think you'll have use more refined readfile() allows set timeout (like curl, or readfile stream context options).

you catch errors occur while downloading, , serve locally hosted fallback document instead. document e.g. text file containing message "resource xyz not loaded".


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -