How to replace local file path to insert url link
download.php
// Free Downloads
if (isset($_GET['free'])) {
$row = $android->getFreeDownload($_GET['free']);
if ($row) {
$fname = basename($row['filename']);
$file_path = '';
$android->fetchFile(BASE_DIR, $fname, $file_path);
$fsize = filesize($file_path);
$fext = strtolower(substr(strrchr($fname, "."), 1));
if (!file_exists($file_path) || !is_file($file_path)) {
redirect_to(($core->seo == 1) ? $core->site_url . '/content/android/?msg=1' : $core->site_url . '/modules.php?module=android&msg=1');
die();
}
if (!array_key_exists($fext, $allowed_ext)) {
redirect_to(($core->seo == 1) ? $core->site_url . '/content/android/?msg=1' : $core->site_url . '/modules.php?module=android&msg=2');
die();
}
if ($android->allow_free == 'n' && !$user->logged_in) {
redirect_to(($core->seo == 1) ? $core->site_url . '/content/android/?msg=1' : $core->site_url . '/modules.php?module=android&msg=3');
die();
}
if ($allowed_ext[$fext] == '') {
$mtype = '';
if (function_exists('mime_content_type')) {
$mtype = mime_content_type($file_path);
} elseif (function_exists('finfo_file')) {
$finfo = finfo_open(FILEINFO_MIME);
$mtype = finfo_file($finfo, $file_path);
finfo_close($finfo);
}
if ($mtype == '') {
$mtype = "application/force-download";
}
} else {
$mtype = $allowed_ext[$fext];
}
// set headers
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: $mtype");
header("Content-Disposition: attachment; filename=\"$fname\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $fsize);
print $android->readFile($file_path, true);
} else {
redirect_to(SITEURL . "/index.php");
}
Thanks All !