php - What causes downloaded files to become corrupt? -


i stugling understand wrong app.

as unable find solution (more here: codeigniter download helper corrupts .7z , .rar files or alternative solutions?) decided take different approach.

so question causes downloaded files via html request (if said right) become corrupt when not corrupted when downloaded via ftp. , follow is, causes specific type of extension become corrupt. since can download zip files fine 7z , rar files corrupted.

this header list codeiniter's download helper uses:

        header('content-type: "'.$mime.'"');         header('content-disposition: attachment; filename="'.$filename.'"');         header("content-transfer-encoding: binary");         header('expires: 0');         header('pragma: no-cache');         header("content-length: ".strlen($data)); 

the helper uses file_get_contents() in order determine content-length , send. tried use filesize() , send file via readfile() result same.

i tried different mimes, inclusive application/octet-stream spefic ones depending on type (application/x-7z-compressed etc) had little effect.

so @ point have no idea causes extensions work while others not.

any suggestion welcome.

is there php, or apache or tweak, property can use change this?

edit:

i noticed reason when open file there added number represents id of download have no idea how got here or how stop it, have put me on right track. much, update 1 progress.

also how prevent php append on top of file?

edit:

found it!

it obscure echo didn't see, tired. gone works fine. i've spend around hours truing find out wrong, pissed of @ myself, right glat over. helping me find problem :)


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -