PDA

View Full Version : Download Script


phillyhotshots
06-11-03, 08:29 PM
I have been looking for a script that does the following:

Install in DIR on server, creates a list of file type and size for everything in that directory with active link for DL. The closest I have found requires login which cannot seem to be removed.

Anyone know of anything?

Stefan
06-12-03, 03:00 AM
have you tried one of those file managers? there are scripts outthere that emulate windows explorer a bit in that you get a directory listing with information and the option to download or upload.

TheGreatOne
06-12-03, 10:08 AM
Good Download Script is www.phparena.net but its not what your looking for. I think theres one called php transverser i think. Thats what ya want ;)

phillyhotshots
06-12-03, 11:12 AM
PHP Transerver is exacly what I am looking for, but can't find a functioning download link anywhere. ANy help?

TheGreatOne
06-12-03, 12:54 PM
well last time today the search function on HS wasent working. I am not sure if this is resolved. It was on there though

daynah
06-12-03, 01:57 PM
Would something like this help? Just put an index.php file in your directory.

Save this file as index.php
<?
include('listing.php');
echo listdir($REQUEST_URI);
?>


Save this file as listing.php

<?
function listdir($REQUEST_URI)
{
// File handle variable to open current directory
$handle = opendir('.');
$dirname = explode('/', $REQUEST_URI);
$dirname = $dirname[1];
$content = 'Files in the directory: <b>/'. $dirname .'/</b><br /><br />';
$content .= '<table cellpadding="3" cellspacing="0">';
$content .= '<tr>
<th>Name</th>
<th>Last Modified</th>
<th>Size</th>
</tr>';

// Loops through the directory
while ($file = readdir($handle))
{
$last_updated = filemtime($file);
$last_updated = date("m/d/Y h:i:s A",$last_updated);

$filesize = filesize($file)/1000;
$filesize = number_format($filesize, 2);

if($file != '.' && $file != '..')
$content .= '<tr>
<td width="100"><a href="'.$file.'">'.$file.'</a></td>
<td width="150">'
.$last_updated.'</td>
<td>'.$filesize.'K</td>
</tr>';
}
$content .= '</table>';

return $content;
}

?>


Then go to the web browser and see if it works. :)

phillyhotshots
06-12-03, 03:00 PM
That worked great Daynah!! Thank you so much for your help! I customized it a little, but wouldn't have known where to start if it wasnt for you! Thanks again!!

daynah
06-12-03, 07:31 PM
No problem. :) I'm glad I could help.

DA Master
06-14-03, 07:39 AM
Nice piece of code their daynah. Well done.

Steven
06-14-03, 08:41 AM
yeah thanks u really good at it :D

phillyhotshots
06-16-03, 09:08 AM
Well if other people are using it, a simple, necessary change I made was:

This Line:
if($file != '.' && $file != '..')

To This:
if($file != '.' && $file != '..' && $file!="listing.php" && $file!="index.php")

This excludes the two PHP files from being listed. Thanks again Daynah, couldnt have done it w/o out. BTW, checked out your site and I like it a lot!

Calarus
12-15-03, 08:08 PM
thanks daynah and phillyhotshots for one the script and two for that little snippet above, it helped. The script etc is awsome, I just wanted to let you guys know I am using it on my site http://ax-n.net , I have different sections of downloads so i have customized the script a bit and include it in each folder etc etc, took me a while but I like the result...

Again super thanks