joecooper Posted March 14, 2006 Share Posted March 14, 2006 im trying to think up a way where the user can download a file, without knowing the download link, (so that i can make a que system ect...). Ive tryed to use include("file.exe"); as a test.. didnt think it would work. but it has the same idea, grabbing a file without the user knowning where it is located.Any code examples? Link to comment https://forums.phpfreaks.com/topic/4986-file-download/ Share on other sites More sharing options...
hitman6003 Posted March 14, 2006 Share Posted March 14, 2006 The forums are acting funny today, so I'll do what I can:[code]$ name = "path/to/f ile.txt";$ type = m ime_content_type($name);$ size = f ilesize($name);h eader("C ontent-length: $size");h eader("C ontent-type: $type");h eader("C ontent-Disposition: attachment; f ilename=$ name");echo f ile_get_contents($ file);[/code]remove the random spaces I've put throughout Link to comment https://forums.phpfreaks.com/topic/4986-file-download/#findComment-17590 Share on other sites More sharing options...
hitman6003 Posted March 14, 2006 Share Posted March 14, 2006 Crazy forum software...caused a double post. Link to comment https://forums.phpfreaks.com/topic/4986-file-download/#findComment-17591 Share on other sites More sharing options...
joecooper Posted March 15, 2006 Author Share Posted March 15, 2006 Lol, thanks!. i will try and find a working version of it Link to comment https://forums.phpfreaks.com/topic/4986-file-download/#findComment-17824 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.