从ftp服务器下载文件已损坏,

时间:2015-11-01 08:36:51

标签: php mysql encryption ftp

我有一个架构,当上传文件到ftp服务器时它自动加密,当下载文件时它自动解密文件。当我尝试运行程序时,将文件上传到ftp服务器,其成功和文件已加密。但是当下载文件时,有时它无法连接到ftp服务器(idm显示进程只是连接),有时它成功下载,但文件已损坏。我想念的是什么? 这里我有代码: prosesdownload.php(此类用于解压缩ftp服务器上的文件)

<html>
<?php
include 'ftpconfig.php';
include 'aes.php';
$file = $_GET['id'];
$fileFtp = 'ftp://'.$ftp_user_name.':'.$ftp_user_pass.'@'.$ftp_server;
$crypt = new aes_encryption();
$fileName = str_replace('.enc','',$fileFtp.'/'.$file);
$fileNamee = str_replace('.enc','',$file);
$enkrip = $crypt->decrypt_file($fileFtp.'/'.$file, $fileName);
if (!$enkrip) {
echo "Gagal";
}
else {
?>
    <head>
    </head>
<body>
<h1><a href="download.php?id=<?php echo $fileNamee ?>">Click Here To Download File</a></h1>
<?php
} 
?>
</body>
</html>

和download.php(以解密文件)

<html>
<?php
include 'ftpconfig.php';
$file = $_GET['id'];
$fileFtp = 'ftp://'.$ftp_user_name.':'.$ftp_user_pass.'@'.$ftp_server.'/'.$file;
?>
    <head>
        <script type="text/javascript">
        window.location.href = "<?php echo $fileFtp?>"

        alert('<?php echo $fileFtp?>');
        window.location.href='delete.php?id=<?php echo $file ?>'

        </script>
    </head>
<body>
</body>
</html>

是什么让文件损坏了? ftp服务器(filezilla)或解密代码?请给我你的意见,它会帮助我,

0 个答案:

没有答案
相关问题