I am adding some small images into mySql. Right before the insert I have the following:
$data = addslashes(fread(fopen($_FILES['uploadfile']['tmp_name'], "r"), $_FILES['uploadfile']['size']));
In another script when I request the image, I use stripslashes, but I can't get it to work. It works fine without using strip slashes. Should I just delete the addslashes line?
<?php
include("dBconnect.inc");
$id = 4;
$get_image = "SELECT filedata, mimetype FROM filestore WHERE filestore_id = $id";
$get_image_result = @mysql_query($get_image) or die("Couldn't get image.");
$filedata = @mysql_result($get_image_result,0,"filedata");
//$teststrip = stripslashes(fread(fopen($filedata, "r")));
$mimetype = @mysql_result($get_image_result,0,"mimetype");
header("Content-type: $mimetype");
echo "$filedata";
?>