Forum Moderators: coopster
<?
$content_len=@filesize("file.zip");
Header("Content-type: application/zip");
Header("Content-type: octet-stream");
Header('Content-Disposition: attachment; filename="file.zip"');
if($content_len!=FALSE)
{
Header("Content-length: $content_len");
}
readfile("file.zip");
?> <?
$id = $_GET['id'];
$filename = "/download/file_".$id.".zip";
header("Content-disposition: attachment; filename=".$filename."");
header('Content-type: application/octet-stream');
readfile($filename);
?> header("Content-disposition: attachment; filename=".$filename."");
but the file name that appears is "/download/file_" as a ZIP,
if (isset($_GET['id']) and is_numeric($_GET['id']) and ($_GET['id'] > 0)) {
$id = $_GET['id'];
$filename = 'file_' . $id . '.zip';
$path = $_SERVER['DOCUMENT_ROOT'] . "/download/$filename";
if (is_file($path)) {
header("Content-disposition: attachment; filename=" . $filename);
header('Content-type: application/octet-stream');
readfile($path);
}
else { echo "<p>$filename is not a file!</p>"; }
}
else { echo "<p>Invalid file request.</p>"; }
if (isset($_GET['id']) and is_numeric($_GET['id']) and ($_GET['id'] > 0)) {
$id = $_GET['id'];
$filename = 'file_' . $id . '.zip';
$file = 'file.zip';
$path = $_SERVER['DOCUMENT_ROOT'] . "/download/$file";
if (is_file($path)) {
header("Content-disposition: attachment; filename=" . $filename);
header('Content-type: application/octet-stream');
readfile($path);
}
else { echo "<p>$filename is not a file!</p>"; }
}
else { echo "<p>Invalid file request.</p>"; }
if (isset($_GET['id']) and is_numeric($_GET['id']) and ($_GET['id'] > 0)) {
$id = $_GET['id'];
$filename = 'file_' . $id . '.zip';
$path = $_SERVER['DOCUMENT_ROOT'] . "/download/$filename";
if (is_file($path)) {
header("Content-disposition: attachment; filename=" . $filename);
header('Content-type: application/octet-stream');
readfile($path);
}
else { echo "<p>$filename is not a file!</p>"; }
}
else { echo "<p>Invalid file request.</p>"; }
Can I organize the files into their respective folders?
Is there anyway I can set it up so the main link (image) to download the file opens a new window...
then having that popup be an .html
anyone would be interested in joining the team we have to run/maintain/code our site?
Is there anyway I can set it up so the main link (image) to download the file opens a new window...
<form action-"yourscript" target="_blank">
or
<form action-"yourscript" onsubmit="return newWin(this);">
<a href="http://www.updateyourblackberry.com/php/gettour.php?id=5104"><img src="http://www.updateyourblackberry.com/images/buttons/dl1.png"></a> How would I stop the direct linking of the php file then?
<script type="text/javascript">
document.write('<style type="text/css">#timed{display:none;}<\/style>')
function delay_link(){
var d=delay_link, t=document.getElementById('timed');
if(d.c&&d.c.nodeValue.replace(/[^\d]*/,'')-1>0){
d.c.nodeValue='\xa0\xa0'+(d.c.nodeValue.replace(/[^\d]*/,'')-1);
setTimeout('delay_link()', 1000)
return;
}
else if(!d.c){
d.c=document.createTextNode('35');
t.parentNode.insertBefore(d.c,t);
setTimeout('delay_link()', 1000)
return;
}
d.c.nodeValue='';
t.style.display='inline';
}
</script>
<div class="my_div"><id="timed" href='http://example.com/mylinkhere</a></div>
<script type="text/javascript">delay_link();</script> <form name="contact_form" method="post" action="http://example.com/get.php?id=6480" onSubmit="return evalid()">
<input type="submit" name="Submit" value="Submit">
</form>