View previous topic :: View next topic |
Author |
Message |
uod -
Joined: 29 Apr 2006 Posts: 8 Location: PH
|
Posted: Sun May 04, 2008 7:31 am Post subject: trigger a script? |
|
|
is there a way to trigger a script, whenever a certain file from a directory is accessed? |
|
Back to top |
|
|
Toasty -
Joined: 21 Feb 2008 Posts: 298 Location: Chicago, IL
|
|
Back to top |
|
|
uod -
Joined: 29 Apr 2006 Posts: 8 Location: PH
|
Posted: Mon May 05, 2008 1:18 pm Post subject: |
|
|
let just say i have a folder "mp3", and someone loaded it, or downloaded it, it should trigger a script. |
|
Back to top |
|
|
rrinc -
Joined: 24 Feb 2006 Posts: 725 Location: Arkansas, USA
|
Posted: Tue May 06, 2008 2:50 am Post subject: |
|
|
The best thing you can do is the reverse but equivalent of what you're wanting (have someone visit a script that then gives them the file or whatever). _________________ -Blake | New Server :D
SaveTheInternet
Soy hispanohablante. Puedes contactarme por mensajes privados. |
|
Back to top |
|
|
uod -
Joined: 29 Apr 2006 Posts: 8 Location: PH
|
Posted: Tue May 06, 2008 11:25 am Post subject: |
|
|
i got your point, is there a a way to literally open the file? "Content-Disposition" is downloading a file, is there a way for example, *.txt file, should be handled by the browser by viewing its content |
|
Back to top |
|
|
rrinc -
Joined: 24 Feb 2006 Posts: 725 Location: Arkansas, USA
|
Posted: Tue May 06, 2008 11:19 pm Post subject: |
|
|
You would need to send the correct mime type in the header. .txt files are text/plain.
In PHP you would do something like:
Code: | <?php
header('Content-type: text/plain');
readfile('file.txt');
?> |
_________________ -Blake | New Server :D
SaveTheInternet
Soy hispanohablante. Puedes contactarme por mensajes privados. |
|
Back to top |
|
|
uod -
Joined: 29 Apr 2006 Posts: 8 Location: PH
|
Posted: Wed May 07, 2008 11:27 am Post subject: |
|
|
thank you
Code: | header('Content-Type: audio/mpeg');
header('Content-Length: ' . filesize($file));
readfile($file);
|
i used this code to satisfy my needs |
|
Back to top |
|
|
|