我加密了图像并存储在数据库中,但是在检索它时它不起作用,某些值显示在浏览器中。
if($_POST())
{
if(isset($_FILES['uploaded_file'])) {
if($_FILES['uploaded_file']['error'] == 0) {
// Connect to the database
$dbLink = mysqli_connect('localhost', 'root', '', 'resume');
if(mysqli_connect_errno())
{
die("MySQL connection failed: ". mysqli_connect_error());
}
$name = $dbLink->real_escape_string($_FILES['uploaded_file']['name']);
$mime = $dbLink->real_escape_string($_FILES['uploaded_file']['type']);
$data = $dbLink->real_escape_string(file_get_contents($_FILES ['uploaded_file']['tmp_name']));
}
}
INSERT INTO `upload` (
`name`, `title`, `data`, `emailid`
)
VALUES (
'{$name}', '{$mime}', '{$data}','$valid_emailid'
)";
}
<form method="post" name="myform" onsubmit="return validateform()" enctype="multipart/form-data" >
<input type="file" name="uploaded_file" id="upload" />
<form method="post" name="myform" enctype="multipart/form-data" >
<input type="file" name="uploaded_file" id="upload" />
</form>