Here i have a problem with the download.php
. I am trying to download file but its not redirecting to the right path where i shared a folder on the ftp server. Its always redirecting to the address where all my file.php
exist.
Here is my home download.php
<?php
include 'dbconfig';
include 'ftpconfig.php';
include 'aes.php';
session_start();
if($_SESSION['user'] and ($_SESSION['nik'])){
}
else{
header("location:index.php");
}
$file = $_GET['id'];
$fileFtp = 'ftp://'.$ftp_user_name.':'.$ftp_user_pass.'@'.$ftp_server.'/'.$file;
$crypt = new aes_encryption();
$fileName = str_replace('.enc','',$fileFtp.$file);
$fileNamee = str_replace('.enc','',$file);
$dekrip = $crypt->decrypt_file($fileFtp.$file, $fileName);
if (!$dekrip) {
echo "Gagal";
}
else {
echo '<script> window.location.href = '.$fileName,'; </script>';
echo "The file ".$fileNamee." downloaded sucessfully";
}
?>
This is the code on my home.php
to download
<td> <a href="download.php=<?php echo $row['file'] ?>" target="_blank">Download</a></td>
When i click the download, its redirect to where the all file.php
exist
http://localhost/aes/download.php81208-mklh.pdf.enc
not in the shared folder on ftp server where i set in F:\ftp
. and all the files is in that folder.
How can i fix that?