Current location: Hot Scripts Forums » Programming Languages » PHP » HELP!Dynamic URLs


HELP!Dynamic URLs

Reply
  #1 (permalink)  
Old 11-25-03, 05:50 PM
arti_z arti_z is offline
New Member
 
Join Date: Nov 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question HELP!Dynamic URLs

Hi Everyone

In a site that I am working on I want people to be able to download files, but I do not want to have a static url to these files, but more a sort of dynamic url that dissappears later on...how can I create these dynamic urls? I tried to look for scripts for this but searching for dynamic urls doesnt give me the right kind of scripts...
best regs
/A
Reply With Quote
  #2 (permalink)  
Old 11-26-03, 03:28 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
you mean a link like this http://www.domain.com/download.php?ID=325 and it still download the file http://www.domain.com/downloads/file325.zip ?
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #3 (permalink)  
Old 11-26-03, 03:33 AM
Stefan's Avatar
Stefan Stefan is offline
Junior Code Guru
 
Join Date: Jun 2003
Location: Utrecht, The Netherlands
Posts: 599
Thanks: 0
Thanked 0 Times in 0 Posts
you'd have to make php serve the files, instead of link directly to the files.
Reply With Quote
  #4 (permalink)  
Old 11-27-03, 01:59 PM
arti_z arti_z is offline
New Member
 
Join Date: Nov 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by NeverMind
you mean a link like this http://www.domain.com/download.php?ID=325 and it still download the file http://www.domain.com/downloads/file325.zip ?
Correct! (and I wish to then put in a sort of timer that removes that link so it is only available for a short period of time).
Reply With Quote
  #5 (permalink)  
Old 11-27-03, 01:59 PM
arti_z arti_z is offline
New Member
 
Join Date: Nov 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Stefan
you'd have to make php serve the files, instead of link directly to the files.
ok...and what is that and how is it done?
thnx
/A
Reply With Quote
  #6 (permalink)  
Old 11-28-03, 04:15 AM
Stefan's Avatar
Stefan Stefan is offline
Junior Code Guru
 
Join Date: Jun 2003
Location: Utrecht, The Netherlands
Posts: 599
Thanks: 0
Thanked 0 Times in 0 Posts
you could store the files in a protected directory or a directory outside the www root, then use a script like this to serve it to the user:

PHP Code:

$size=filesize("$doc_path/$file");

header("Content-type: $filetype");
header("Content-length"$size);
header("Content-Disposition: attachment; filename=$filename");
header("Content-Description: File download");

echo 
fread(fopen("$doc_path/$file""r"), filesize("$doc_path/$file")); 
$doc_path here points to the directory where the files are located.
Reply With Quote
Reply

Bookmarks


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
friendly urls? conv fred.asp?id=100 into fred,100.htm trooperbill ASP 3 10-20-03 02:59 AM
ASP friendly urls trooperbill Script Requests 0 10-17-03 06:47 AM
dynamic url's in xhtml pages? tom HTML/XHTML/XML 4 09-26-03 05:11 PM
Trouble with parameter passing in URLs and str_replace crookyboy PHP 2 09-16-03 05:30 AM
Search Engine Friendly URLs Naz PHP 2 09-15-03 05:57 AM


All times are GMT -5. The time now is 06:01 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.