Jump to content

php script for download

ffpc

hi, is anyone here know how can i make a user browse file to all my shared folder and let them download it? i know i can put them in my script folder but it's kind of annoying to move stuffs. thnx

Link to comment
Share on other sites

Link to post
Share on other sites

So you basically wants a script that lists files from a directory, and make so that users can download them? Without moving the files?

 

For the reading please have a look at: opendirreaddir and scandir.

 

However just creating the links is very unsecure, and i would recommend there was some sort of authentication before people can download :)

 

Examples (stolen from the PHP Manual / Docs):

<?php$dir = "/tmp";$dh  = opendir($dir);while (false !== ($filename = readdir($dh))) {    $files[] = $filename;}sort($files);print_r($files);rsort($files);print_r($files);?>

Output:

Array(    [0] => .    [1] => ..    [2] => bar.php    [3] => foo.txt    [4] => somedir)Array(    [0] => somedir    [1] => foo.txt    [2] => bar.php    [3] => ..    [4] => .)

Best regards Zahlio,
Unity asset developer - Game developer (http://playsurvive.com) - Computer Science student

Link to comment
Share on other sites

Link to post
Share on other sites

 

So you basically wants a script that lists files from a directory, and make so that users can download them? Without moving the files?

 

For the reading please have a look at: opendirreaddir and scandir.

 

However just creating the links is very unsecure, and i would recommend there was some sort of authentication before people can download :)

 

Examples (stolen from the PHP Manual / Docs):

<?php$dir = "/tmp";$dh  = opendir($dir);while (false !== ($filename = readdir($dh))) {    $files[] = $filename;}sort($files);print_r($files);rsort($files);print_r($files);?>

Output:

Array(    [0] => .    [1] => ..    [2] => bar.php    [3] => foo.txt    [4] => somedir)Array(    [0] => somedir    [1] => foo.txt    [2] => bar.php    [3] => ..    [4] => .)

so it's is possible to let my user dowload from my shared documents? like for example using xp. my shared music was in this dir "C:\Documents and Settings\All Users\Documents\My Music"

Link to comment
Share on other sites

Link to post
Share on other sites

so it's is possible to let my user dowload from my shared documents? like for example using xp. my shared music was in this dir "C:\Documents and Settings\All Users\Documents\My Music"

Depends on how your code looks like ;)

Best regards Zahlio,
Unity asset developer - Game developer (http://playsurvive.com) - Computer Science student

Link to comment
Share on other sites

Link to post
Share on other sites

if you want a nice user interface etc download this

 

Ajaxplorer 5

Our Lord and Saviour Chunt!!!

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×