but people click on this URL, the program will prompt the user of the location for which the file will be stored and a number will increment by one in the database.
How do I do this? Also, I wanna to do this for 2 obvious reasons:
1. To avoid people linking to my file
2. To keep track of the number of downloads
I just finished a script just like that I don't have mysql, so it creates a text file (or adds 1 to an existing file) depending on which file is after the .php?
If I could use mysql I would But as of now my provider doesn't have it. (yet)
The whole key is the onload() javascript call, it will just fwd the user to $go, if its a .zip it will prompt to download, I just use it for going to domains like clickcount.php3?go=www.yahoo.com
That adds a line to the HTTP headers that get sent with the current file. The line in question instructs the browser to load the specified URL instead. Seems like exactly what you need to me.
I suggest you look in the PHP manual at the HTTP functions as you need to add some extra header fields to the Location header when you are using it to prompt people for a file download, one such header field places a suggest name to save the file as (If you don't use it then the url of the link the person clicked on will be in the filename box).
Depending on the browser used it will mask the url, but seen as you are using it for file downloads then the URL will not appear in the address bar, however (Their is always something) if you linked it to a PDF file and the user had Adobe Acrobat installed and integrated with IE then IE would just simple open the file and it might (I say might because IE is funny sometimes) reveal the true URL of the file.
------------------
Karl Austin KDA Web Services
"Everyone has a photographic memory. Some just don't have film."
You can't rely on header() hiding the URL of the file you're redirecting to, no. There is no way you can do what you want using a simple redirect. Instead, you'll need to load the file in PHP and then send it to the browser as if it was the contents of the page. The code would be along these lines:
// Identify this page as a binary file
header("content-type: application/octet-stream");
// Open the file
$file = fopen("/path/to/file.zip","r");
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>Originally posted by kyank: You can't rely on header() hiding the URL of the file you're redirecting to, no. There is no way you can do what you want using a simple redirect. Instead, you'll need to load the file in PHP and then send it to the browser as if it was the contents of the page. The code would be along these lines:
// Identify this page as a binary file
header("content-type: application/octet-stream");
// Open the file
$file = fopen("/path/to/file.zip","r");
// Send the file
fpassthru($file);
<HR></BLOCKQUOTE>
I have copied the same thing into my PHP3 program.
<?
// Identify this page as a binary file
header("content-type: application/octet-stream");
// Open the file
$file = fopen("/virtualhosts/usbworkshop.com/www/files/usbready.exe","r");
Bookmarks