User Name Password Register
DaniWeb IT Discussion Community
All
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,163 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 3,340 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: 1778 | Replies: 18
Reply
Join Date: Jun 2007
Posts: 71
Reputation: Pro2000 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Pro2000's Avatar
Pro2000 Pro2000 is offline Offline
Junior Poster in Training

button (Save target as)

  #1  
Nov 26th, 2007
Hi, I tried this code:

<?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!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2007
Posts: 71
Reputation: Pro2000 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Pro2000's Avatar
Pro2000 Pro2000 is offline Offline
Junior Poster in Training

Re: button (Save target as)

  #2  
Nov 26th, 2007
Maybe you did not understand.. explain? :
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!
Reply With Quote  
Join Date: Sep 2007
Location: Budapest
Posts: 251
Reputation: fatihpiristine has a little shameless behaviour in the past 
Rep Power: 0
Solved Threads: 12
fatihpiristine's Avatar
fatihpiristine fatihpiristine is offline Offline
Posting Whiz in Training

Re: button (Save target as)

  #3  
Nov 26th, 2007
<a href="file1">File 1</a>
<a href="file2">File 2</a>
.....
.....
put this in for loop and it is ready
Reply With Quote  
Join Date: Jun 2007
Posts: 71
Reputation: Pro2000 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Pro2000's Avatar
Pro2000 Pro2000 is offline Offline
Junior Poster in Training

Re: button (Save target as)

  #4  
Nov 26th, 2007
Originally Posted by fatihpiristine View Post
<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!
Reply With Quote  
Join Date: Sep 2007
Location: Budapest
Posts: 251
Reputation: fatihpiristine has a little shameless behaviour in the past 
Rep Power: 0
Solved Threads: 12
fatihpiristine's Avatar
fatihpiristine fatihpiristine is offline Offline
Posting Whiz in Training

Re: button (Save target as)

  #5  
Nov 28th, 2007
i think u dont know how to make request. it was an idea. just put there if else looop.. thats all
Reply With Quote  
Join Date: Jun 2007
Posts: 71
Reputation: Pro2000 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Pro2000's Avatar
Pro2000 Pro2000 is offline Offline
Junior Poster in Training

Re: button (Save target as)

  #6  
Nov 28th, 2007
Originally Posted by fatihpiristine View Post
i think u dont know how to make request. it was an idea. just put there if else looop.. thats all

Thanks but that is not correct.
I want a button locates to another page which can download a file automaticially in the header.

Thanks..
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
Reply With Quote  
Join Date: Sep 2007
Location: Budapest
Posts: 251
Reputation: fatihpiristine has a little shameless behaviour in the past 
Rep Power: 0
Solved Threads: 12
fatihpiristine's Avatar
fatihpiristine fatihpiristine is offline Offline
Posting Whiz in Training

Re: button (Save target as)

  #7  
Nov 28th, 2007
well.. i ll try to find my code then lll post it
Reply With Quote  
Join Date: Jun 2007
Posts: 71
Reputation: Pro2000 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Pro2000's Avatar
Pro2000 Pro2000 is offline Offline
Junior Poster in Training

Re: button (Save target as)

  #8  
Nov 28th, 2007
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!
Reply With Quote  
Join Date: Nov 2007
Posts: 5
Reputation: jimmyvazquez is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jimmyvazquez jimmyvazquez is offline Offline
Newbie Poster

Re: button (Save target as)

  #9  
Nov 29th, 2007
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.[/quote]
Reply With Quote  
Join Date: Jun 2007
Posts: 71
Reputation: Pro2000 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Pro2000's Avatar
Pro2000 Pro2000 is offline Offline
Junior Poster in Training

Re: button (Save target as)

  #10  
Dec 1st, 2007
Originally Posted by jimmyvazquez View Post
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.
[/quote]
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!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 7:29 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC