Jump to content


Photo

File download


  • Please log in to reply
3 replies to this topic

#1 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 14 March 2006 - 11:02 PM

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?
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 14 March 2006 - 11:14 PM

The forums are acting funny today, so I'll do what I can:

$ 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);

remove the random spaces I've put throughout

#3 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 14 March 2006 - 11:15 PM

Crazy forum software...caused a double post.

#4 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 15 March 2006 - 02:32 PM

Lol, thanks!. i will try and find a working version of it
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users