Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made the 'no file to download' page similar to the main page #6

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 19 additions & 18 deletions index.php
Expand Up @@ -30,32 +30,33 @@
$filename = fopen($thefilename, 'w');
fwrite($filename, $localfname);
fclose($filename);

die('DONE');
}

if (isset($_GET['type']) && $_GET['type'] == 'download')
{
if (!file_exists($thefiledata) || !file_exists($thefilename))
{
echo '<html><head><meta name="viewport" content="width=device-width, initial-scale=1.0" /></head><body><a href="index.php">NO FILE UPLOADED YET, RELOAD PAGE</a></body></html>';
echo '<html><head><meta content="width=device-width, initial-scale=1.0" name="viewport"><style type="text/css">*{color:white;font-family:sans-serif;padding:0em;margin:0;cursor:pointer;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}body{width:100%;top:0;position:absolute;background-color:#f90;height:100%;left:0}a{position:absolute;top:0;height:100%;text-align:center;width:100%;text-decoration:none;display:block}a div{position:relative;top:45%;height:auto;text-align:center;width:100%;font-size:2.5em;text-decoration:none}a span{font-size:70%}</style><title></title></head><body> <a href="./"><div>NO FILE UPLOADED YET<br /><span>CLICK TO RELOAD</span></div></a></body></html>';
exit;
}
$fname = file_get_contents($thefilename);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $fname . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($thefiledata));
readfile($thefiledata);

if ($autoeraseafterdownload)
{
unlink($thefiledata);
unlink($thefilename);
}

$fname = file_get_contents($thefilename);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $fname . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($thefiledata));
readfile($thefiledata);

if ($autoeraseafterdownload)
{
unlink($thefiledata);
unlink($thefilename);
}
exit;
}
?>
Expand All @@ -76,7 +77,7 @@
<body>
<input type='file' id='file' />
<div id="upload"><div class="text" id="uploadtext">UPLOAD</div></div>
<a href="index.php?type=download" id="download"><div class="text">DOWNLOAD</div></a>
<a href="index.php?type=download"><div id="download"><p class="text">DOWNLOAD</p></div></a>
<input id="email_addr" type="text" name="email" size="25" value="" autocomplete="off" />
<script>
var upload = document.getElementById('upload');
Expand Down