我正在开发一个项目,用户需要上传非常敏感的图片(想想许可证,社会保障等等)。此应用程序是基于Web的(PHP)并托管在Ubuntu服务器上。我还需要能够在以后由授权用户查看这些内容。
如何做到这一点?加密原始图像数据?什么类型的加密?
答案 0 :(得分:0)
解决方案是将文件存储在公用文件夹之外,然后执行此操作以获取文件
echo date("h:i:s", strtotime($actual."-2 hour"));
从保护服务器管理员使用此
<?php
//verfit the user and permission here
if (!$verfiy) {
die();
}
$file_name = "fullpath/".$_GET['file'];
//check if
if (file_exists($file_name)) {
flush();
$check = true;
$filename = $file_name . '.pdf'; //extension
$mimetype = 'application/pdf'; //what type of file you are requesting
$data = file_get_contents($file_name); //get teh file
$size = strlen($data);
header("Content-Disposition: attachment; filename = $filename");
header("Content-Length: $size");
header("Content-Type: $mimetype");
echo $data;
exit;
}
?>
它将创建受密码保护的zip文件并获取实际文件使用密码到dcrpyt并解压缩用户的zip文件