Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

this script is ticking me off

Status
Not open for further replies.

littleblu87

Technical User
Oct 17, 2003
15
US
I'm just learning PHP and I need some help with this script.

The purpose of this script is to hide the location of the file that's to be downloaded.

The file (test.zip) is located here: and the script (downlod.php) is located here:
The problem is that the script assumes the file to be downloaded is in directory1 with the script. So the only thing that downloads is an empty zip file.

How do I specify in the script where the test.zip file is located at? I've been researching this thing for days and I can't find anything that works. I must be terribly pathetic, lol.

Code:
<?php

header ( "Content-type: application/zip" );

header ( "Content-Disposition: attachment; filename=test.zip" );

readfile ( 'test.zip' );

?>
 
If you only specify a filename it will look in it's current directory (which is where download.php is located).

Try,
readfile( '../directory2/test.zip' );
 
Have you tried putting the full path as the argument to readfile?

eg readfile(dirname(dirname(__FILE__))."/directory2/test.zip');
 
It's still not working.

Is it possible that the webspace provider (Tripod) disabled something that would prevent this script from working? It looks like they disabled the realpath function, would that have any affect on the script?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top