Re: [PHP] Using PHP to remove certain number of bytes from file



On Sun, 2007-12-30 at 17:20 +0000, Scott Wilcox wrote:
Is it possible with PHP to remove a certain number of bytes from a file,
purely within PHP?

Yes. Why wouldn't it?

If so, does someone have an example of doing this, removing the first
230 bytes from a file.

No, that's an awfully specific problem. But here's the tools you'll
need:

fopen(), fread(), fwrite(), fclose().

Further info... you could do this without creating a separate temporary
file (meaning shift bytes within a single file), but I suggest using a
temporary target file for writing the new content, and then replacing
the original once everything has completed successfully.

Cheers,
Rob.
--
............................................................
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
............................................................
.


Quantcast