file download script
Moderator: General Moderators
-
manojsemwal1
- Forum Contributor
- Posts: 217
- Joined: Mon Jun 29, 2009 4:13 am
- Location: India
file download script
anybody having file download script in php or tutorial i used <a href="http://path/to/script/download.php?f=ph ... .zip">Cool PHP Tutorial</a> script it works but after download file file has been currepted.............
Re: file download script
Can u explain? What you mean by a file download script...like what exactly do you want it to do.?
Re: file download script
You can use this function
Code: Select all
function force_download($file)
{
$dir = "";
if ((isset($file))&&(file_exists($dir.$file)))
{
header("Content-type: application/force-download");
header('Content-Disposition: inline; filename="' . $dir.$file . '"');
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($dir.$file));
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $file . '"');
readfile("$dir$file");
}
}
-
manojsemwal1
- Forum Contributor
- Posts: 217
- Joined: Mon Jun 29, 2009 4:13 am
- Location: India
Re: file download script
download script means....
i have a site where i want to give a link, through that link the visitor can download the any type of file like doc,zip,pdf etc.
when the visitor click on the link it will ask for save as.
regards,
i have a site where i want to give a link, through that link the visitor can download the any type of file like doc,zip,pdf etc.
when the visitor click on the link it will ask for save as.
regards,
-
manojsemwal1
- Forum Contributor
- Posts: 217
- Joined: Mon Jun 29, 2009 4:13 am
- Location: India
Re: file download script
The Above function where i have to define the directory path where we kept the file.....
-
manojsemwal1
- Forum Contributor
- Posts: 217
- Joined: Mon Jun 29, 2009 4:13 am
- Location: India
Re: file download script
Dear Friend
iam asking where i have to define folder path...............?
iam asking where i have to define folder path...............?