ecopetition Posted August 1, 2008 Share Posted August 1, 2008 Hi, I'm looking to make a file have a secret URL with PHP. I want it so that the URL www.x.com/files/file.zip is shown as www.x.com/download.php?file_id=1 (or otherwise). The filename is stored in a database, is assigned a unique ID, and the actual file is stored in a folder under and encrypted name (random MD5 hash). I tried searching this but only came up with one script which wasn't suitable. Any ideas? Thank you. Link to comment https://forums.phpfreaks.com/topic/117729-secret-download-urls/ Share on other sites More sharing options...
The Little Guy Posted August 1, 2008 Share Posted August 1, 2008 http://phpsnips.com/snippet.php?id=55 Link to comment https://forums.phpfreaks.com/topic/117729-secret-download-urls/#findComment-605532 Share on other sites More sharing options...
ecopetition Posted August 1, 2008 Author Share Posted August 1, 2008 Thanks but line 2 - "$filename = $_GET['file']; //Get the fileid from the URL" returns "[NuclearBB Notice] Undefined index: d (Line 335, File viewtopic.php)" Link to comment https://forums.phpfreaks.com/topic/117729-secret-download-urls/#findComment-605613 Share on other sites More sharing options...
Kairu Posted August 1, 2008 Share Posted August 1, 2008 That usually means you are calling it wrong. You need to call it like: http://yoursitename.com/directory/phpfile.php?file=<id> Undefined index usually means the variable you are tying to call does not exist. And remember that PHP is case sensitive, so ?File= and ?file= are not the same thing. See if that clears it up. Link to comment https://forums.phpfreaks.com/topic/117729-secret-download-urls/#findComment-605647 Share on other sites More sharing options...
chronister Posted August 2, 2008 Share Posted August 2, 2008 Notice:Undefined Index ........ PHP Error reporting is set to E_ALL or E_NOTICE. ini_set('error_reporting', E_ERROR); Drop that in your page(s) and it will take error_reporting to a less strict level. Or on the other hand, you can fix the errors by initiating the variables first. Nate Link to comment https://forums.phpfreaks.com/topic/117729-secret-download-urls/#findComment-605806 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.