This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
1
Trying to have a user upload a binary file, search for a specific set of binary bytes and replace them - help would be appreciated
Post Body
So I am basically trying to say search for "00 40 02 10 C2" and replace it but obviously it does not work on a line break.
This is what I have so far:
$tmpFile = file_get_contents($_FILES["file"]["tmp_name"]);
$handle = @fopen($_FILES["file"]["tmp_name"], "r");
if ($handle) {
while (!feof($handle)) {
$hex = bin2hex(fread ($handle , 4));
$hex = str_replace("00400210c2", "METHOD", $hex);
echo $hex."\n";
}
fclose($handle);
}
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 3 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/PHPhelp/com...