By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

how to use stream_filter_append, for zlib?

P: n/a
Hello,

I am trying to decompress some data in a file, from PHP. It's data that
has been zlib-compressed on a handheld device and sent wirelessly to the PHP
server.

I can open the file and read some regular data from it. When I get to the
position where my zlib compressed information starts, I make these calls:

$zlib_filter = stream_filter_append($cellfile, 'zlib.inflate',
STREAM_FILTER_READ, 1);
$data = fread($cellfile, $thumblength);
stream_filter_remove($zlib_filter);

Is that the right way to do it? I am getting this error:

stream_filter_append() [<a
href='function.stream-filter-append'>function.stream-filter-append</a>]:
Filter failed to process pre-buffered data. Not adding to filterchain.
I put 1 for the compression level, because originally I only compress with
one pass of the zlib.compress function. I hope that it is possible to use
this zlib decompression from some point within a regular file. I do not want
to go the route of compressing my entire file with gzip. I appreciate any
tips on what I might be doing wrong.

Thanks,
B
Dec 10 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.