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



Maybe one of these days I'll remember to actually reply to the list the
first time.


---------- Forwarded message ----------
From: Benjamin Darwin <bddarwin@xxxxxxxxx>
Date: Dec 30, 2007 2:12 PM
Subject: Re: [PHP] Using PHP to remove certain number of bytes from file
To: Scott Wilcox <sc0tt@xxxxxxx>


Try this:

$file_data = file_get_contents('filename', false, null, 230);
file_put_contents('filename', $file_data);

This should do exactly what you need, although you may want to see if either
one returns false (indicating an error) and stop the script.

On Dec 30, 2007 12:20 PM, Scott Wilcox <sc0tt@xxxxxxx> wrote:

Is it possible with PHP to remove a certain number of bytes from a file,
purely within PHP?

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

Thanks,

Scott.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Benjamin Darwin
bddarwin@xxxxxxxxx

"Dream as if you'll live forever, live as if you'll die today." ~James Dean

Quantcast