•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,566 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,621 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1780 | Replies: 18
![]() |
| |
Hi, I tried this code:
I want the user to download those files from a folder named Archives... Example:
Archives/File1.zip
or Archives/File2.zip
Please I want your help quickly... Thanks.
<?php
session_start();
$id=$_GET['fileid'];
if($id=="1")
{
$dwnld = "File1.zip";
}
else if($id=="2")
{
$dwnld = "File2.zip";
}
else if($id=="3")
{
$dwnld= "File3.zip";
}
if($id)
{
header("Content-type: application/download");
header("Content-disposition: filename=$dwnld");
readfile($dwnld);
}
?>I want the user to download those files from a folder named Archives... Example:
Archives/File1.zip
or Archives/File2.zip
Please I want your help quickly... Thanks.
Last edited by Pro2000 : Nov 26th, 2007 at 1:47 pm.
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
Maybe you did not understand.. explain? :
I just want to download a file by clicking on a button.. can any one help me? :?

I just want to download a file by clicking on a button.. can any one help me? :?
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
•
•
•
•
<a href="file1">File 1</a>
<a href="file2">File 2</a>
.....
.....
put this in for loop and it is ready
maybe you did not ubderstand...
I want the page download the file automatically when the variable ($id=="1") or ($id=="2")
or ($id=="3")....
can anyone tell me? Please quickly... Thanks.
Last edited by Pro2000 : Nov 26th, 2007 at 11:18 pm. Reason: loss some letters
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
Thanks... Waiting for it...
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
•
•
Join Date: Nov 2007
Posts: 5
Reputation:
Rep Power: 0
Solved Threads: 0
Intenta con eso a ver si te funciona.. :p
I want the user to download those files from a folder named Archives... Example:
Archives/File1.zip
or Archives/File2.zip
Please I want your help quickly... Thanks.[/quote]
<?php
session_start();
$id=$_GET['fileid'];
if($id=="1")
{
$dwnld = "File1.zip";
}
else if($id=="2")
{
$dwnld = "File2.zip";
}
else if($id=="3")
{
$dwnld= "File3.zip";
}
if($id)
{
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=".$dwnld."\n\n");
$fp=fopen("$dwnld", "r");
fpassthru($fp);
}
?>I want the user to download those files from a folder named Archives... Example:
Archives/File1.zip
or Archives/File2.zip
Please I want your help quickly... Thanks.[/quote]
•
•
•
•
Intenta con eso a ver si te funciona.. :p
<?php
session_start();
$id=$_GET['fileid'];
if($id=="1")
{
$dwnld = "File1.zip";
}
else if($id=="2")
{
$dwnld = "File2.zip";
}
else if($id=="3")
{
$dwnld= "File3.zip";
}
if($id)
{
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=".$dwnld."\n\n");
$fp=fopen("$dwnld", "r");
fpassthru($fp);
}
?>
I want the user to download those files from a folder named Archives... Example:
Archives/File1.zip
or Archives/File2.zip
Please I want your help quickly... Thanks.
Thanks, But what will these functions do :
$fp=fopen("$dwnld", "r");
fpassthru($fp);
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- "Save Target As.." isn't working in IE6 (Web Browsers)
- Save Target as... (JavaScript / DHTML / AJAX)
- Save target as... (Windows NT / 2000 / XP / 2003)
Other Threads in the PHP Forum
- Previous Thread: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
- Next Thread: sha1 md5


Hybrid Mode