Results 1 to 10 of 44
-
12th Mar 2012, 02:46 PM #1OPMemberWebsite's:
heroturko.biz softpk.com gfxtra.biz hotfilegfx.comI need Script Php
Hello,
sir i need directory listing php script what can you do? for example:
File Name || Size || Upload Date || Download Button || Edit || Delete
Thank Yousoftpk Reviewed by softpk on . I need Script Php Hello, sir i need directory listing php script what can you do? for example: File Name || Size || Upload Date || Download Button || Edit || Delete Thank You Rating: 5
-
12th Mar 2012, 02:48 PM #2Too busy :|Website's:
L337Fx.com BeastieBay.netYou can just use wordpress for this, customize the template and change the view as per what you listed.
-
12th Mar 2012, 04:54 PM #3MemberWebsite's:
sborg.usGoogle for "PHP file manager" and you'll find many to cater your needs.
V3g3ta | Halcyon | Abhi
-
12th Mar 2012, 04:59 PM #4BannedWebsite's:
cityvillehelp.comgoogle
directory lister ... PHP script
google result
best script i suggest
you can dwld by clicking on the name of the file in this ^ script
demo
-
12th Mar 2012, 06:16 PM #5OPMemberWebsite's:
heroturko.biz softpk.com gfxtra.biz hotfilegfx.comdon't show directory files show this code
PHP Code:<?php
####################################################################################################################################
####################################[[[ SCROLL TO BOTTOM OF THIS FILE TO CHANGE THE TEMPLATE ]]]####################################
####################################################################################################################################
/*
* ALL IN ONE FOLDER/FILE LISTER
*
* Author: Greg Johnson
* Info: http://greg-j.com/some-url
* License: Creative Commons 3.0
* @ http://creativecommons.org/licenses/by-sa/3.0/us/
*
*/
/* Report errors. Ignore pesky notices.
* There are a few places this script assumes information is
* available for folders (size, for example) that does not
* exist. Let's just make sure you're not reporting notices.
*/
error_reporting(1);
/**********************************************************************************************************************************/
/*******************************************************************************************************************[ SETTINGS ]***/
// Set sorting properties.
$sort = array(
array('key'=>'lname', 'sort'=>'asc'), // ... this sets the initial sort "column" and order ...
array('key'=>'size', 'sort'=>'asc') // ... for items with the same initial sort value, sort this way.
);
/**********************************************************************************************************************************/
/*********************************************************************************************************************[ IMAGES ]***/
// Are we requesting an image?
if(isset($_GET['image']))
{
// Accomidate uppercase & lowercase file extensions
$image = strtolower($_GET['image']);
// Set filetypes (most of this list is from http://www.filezed.com)
$filetype = array(
'text' => array('doc', 'docx', 'txt', 'rtf', 'odf', 'text', 'nfo'),
'audio' => array('aac', 'mp3', 'wav', 'wma', 'm4p'),
'graphic' => array('ai', 'bmp', 'eps', 'gif', 'ico', 'jpg', 'jpeg', 'png', 'psd', 'psp', 'raw', 'tga', 'tif', 'tiff'),
'video' => array('mv4', 'bup', 'mkv', 'ifo', 'flv', 'vob', '3g2', 'bik', 'xvid', 'divx', 'wmv', 'avi', '3gp', 'mp4', 'mov', '3gpp', '3gp2', 'swf'),
'archive' => array('7z', 'dmg', 'rar', 'sit', 'zip', 'bzip', 'gz', 'tar'),
'app' => array('exe', 'msi', 'mse', 'bat'),
'script' => array('js', 'html', 'htm', 'xhtml', 'jsp', 'asp', 'aspx', 'php', 'xml', 'css')
);
// Set the mimetype and cache the image for a year
header("Content-type: image/png");
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 60 * 60 *24 * 365) . ' GMT');
// Deliver the correct image ...
if($image == '.') echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAk1JREFUeNqMU01oE0EU/mY2u22qMSE2UaFKiwdLD0WE+nPx6MFDQfGmBw9evSmKeBE8C/XixZvowR+QXlQQb14KaiAnY9OKjU0Q11hSN012Z8b3JrtJWhBc+JidN+/75nvv7YrKggQ/QuAiLYfwf883Y/CYX1ImjlBgcvLC/bvd5hrC1g+4mSK87ASt+yGkM6A6DioPz91Otiml+0fS230A7tg+GGgSqWPLX8Vm9T1yM/PkUPScui6II/skFoghtYqgux2Ybgh3tIDM5Cm021uoN36h+bsFe07g3IQ37MAxSoFhS7J9EWi1/mAsDLFJyKRdSIoRp19TKtohwDf07UmJIOhgJArtXtFqSIA4DvWM+0YCaiCgVWiTBgoCId2sYlF7RjHisIOjJFCS7CBGStOJjqIh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BTsruM1HtBKVPmFIUNusBrV3B4ev6bsbyXlPdkbr/u+StHUkxruBPY+0KY8f38oWX/byvNAdluHNLeOxDB+uyQQfPCWZ3NT69BYJWkjxjnB1o9Fv/ASQ5s+ABz8i2AAAAAElFTkSuQmCC');
elseif(in_array($image, $filetype['text'])) echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAADoSURBVBgZBcExblNBGAbA2ceegTRBuIKOgiihSZNTcC5LUHAihNJR0kGKCDcYJY6D3/77MdOinTvzAgCw8ysThIvn/VojIyMjIyPP+bS1sUQIV2s95pBDDvmbP/mdkft83tpYguZq5Jh/OeaYh+yzy8hTHvNlaxNNczm+la9OTlar1UdA/+C2A4trRCnD3jS8BB1obq2Gk6GU6QbQAS4BUaYSQAf4bhhKKTFdAzrAOwAxEUAH+KEM01SY3gM6wBsEAQB0gJ+maZoC3gI6iPYaAIBJsiRmHU0AALOeFC3aK2cWAACUXe7+AwO0lc9eTHYTAAAAAElFTkSuQmCC');
elseif(in_array($image, $filetype['audio'])) echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAdRJREFUeNqkU89rE1EQ/maz2STbQKTV1AqRWovFBgKCQsFToEfRmxfBP0DwIl56KkUPglfP0lOhBQVpDz305EmpeNAWPAQaSBoDTUuz2SabZN97nRdN0uqmFhz49s3Oj+8x82ZIKYX/EbOrPNwYGKNvGGEcdA0rs32ncc6LnulPva5weChPOc5LMMe4f2YJmn2QFAo/c6nU2JIQyPLvZiBBsegPJIhGk3e2t0vriURyzXHkLSBS+osgHnMRMsPwpY1crnWKIBIhxzQvZnd3yx8N49IrNj0e2APbNjAxYUEpowfPI/i+0SQafaRU40FgCSclHjcwNWWhst+3x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7rfCXAAJNovyFuktgQAAAAAElFTkSuQmCC');
elseif(in_array($image, $filetype['video'])) echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAdxJREFUeNqMU81KI0EQ7t9EhNU3CHjw4s0nyLKEnLz5HotP4AP4AAp5B2FZ2BxCDsoKQm57yhIU3Bwig2IwEyczY3fVVo2dTUY3uzb0dHfV91V9XdUjEVF0u90zIUS92WyeineMTqezT8t5o9H4aNgAAHVaJM3To6OTndksAw5MAwFQ8B4RsFKx6vDw4CfhGVsA5gFEMHxJkhTG48dnIgUyiPneWsNEBXwIYzkAO78655BnkZTIjKUzjEZR7r1nol5WoPhDDhGcynvgBMgf2mOaZv7q6tfs7m5MATBgPDLnTwBWQAaOqhnE2cmEee7h5maUpqnzWluG4wvGy6B6oSDcS5F6YD+Z8Pb2IXNOeGMqgqeUxY3Vizq/qAHdkZySFXR7vW9VWqtRFLnBYCBft5BgGSvA0CYzVxCKcr67u5ckycxvbt5nW1ufYJlsjFbt9rHhIpe6EAJwtu+IEvIcnRAWrLWl7EotalB6B3yFYLj0XlMA4a1dW/UQ9b8U9Ki4TkqN1lb/RmaieaMgp5TB8ANR50pxxXGVggrhywomk0nRBSrsNaKKtTYr2YT5EMdxuQv9fv+iVquxIWq1Pm//72+cTqc4HA4vintzIEq+TvuN+cN6x+D2xsR9+i3AAEgKanVYjEzGAAAAAElFTkSuQmCC');
elseif(in_array($image, $filetype['archive'])) echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAEUSURBVCjPXdFNSsMAEIbh0Su4teAdIgEvJB5C14K4UexCEFQEKfivtKIIIlYQdKPiDUTRKtb0x6ZJ+volraEJ3+zmycwkMczGzTE3lwkbxeLE5XTqQfTIjhIm6bCy9E/icoOoyR4v7PLDN+8ibxQHxGzE3JBfHrgUalDnQ6BNk1WRFPjs66kDNTxqg0Uh5qYg4IkrjrS9pTWfmvKaBaGaNU4EY+Lpkq88eKZKmTAhbd3i5UFZg0+TzV1d1FZy4FCpJCAQ8DUnA86ZpciiXjbQhK7aObDOGnNsUkra/WRAiQXdvSwWpBkGvQpnbHHMRvqRlCgBqkm/dd2745YbtofafsOcPiiMTc1fzNzHma4O/XLHCtgfTLBbxm6KrMIAAAAASUVORK5CYII=');
elseif(in_array($image, $filetype['app'])) echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFiSURBVBgZpcEhbpRRGIXh99x7IU0asGBJWEIdCLaAqcFiCArFCkjA0KRJF0EF26kkFbVVdEj6/985zJ0wBjfp8ygJD6G3n358fP3m5NvtJscJYBObchEHx6QKJ6SKsnn6eLm7urr5/PP76cU4eXVy/ujouD074hDHd5s6By7GZknb3P7mUH+WNLZGKnx595JDvf96zTQSM92vRYA4lMEEO5RNraHWUDH3FV48f0K5mAYJk5pQQpqIgixaE1JDKtRDd2OsYfJaTKNcTA2IBIIesMAOPdDUGYJSqGYml5lGHHYkSGhAJBBIkAoWREAT3Z3JLqZhF3uS2EloQCQ8xLBxoAEWO7aZxros7EgISIIkwlZCY6s1OlAJTWFal5VppMzUgbAlQcIkiT0DXSI2U2ymYZs9AKWWHL4n+df3pncsI0bn5dX344W05dhctUFbapZcE2ToiLVHBMbGymS7aUhIdoPNBf7Jjw/gQ77u4AAAAASUVORK5CYII=');
elseif(in_array($image, $filetype['script'])) echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAA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1QS3ThqVQbBBlsbgpXLYE8lHCXrqLptf9km7Dzv+FwGTaznIAAAAAElFTkSuQmCC');
// Exit this script when the correct image has been served
exit();
}
/**********************************************************************************************************************************/
/************************************************************************************************************[ DIRECTORY LOGIC ]***/
// Get this folder and files name.
$this_script = basename(__FILE__);
$this_folder = str_replace('/'.$this_script, '', $_SERVER['SCRIPT_NAME']);
// Declare vars used beyond this point.
$file_list = array();
$folder_list = array();
$total_size = 0;
// Open the current directory...
if ($handle = opendir('.'))
{
// ...start scanning through it.
while (false !== ($file = readdir($handle)))
{
// Make sure we don't list this folder, file or their links.
if ($file != "." && $file != ".." && $file != $this_script)
{
// Get file info.
$stat = stat($file); // ... slow, but faster than using filemtime() & filesize() instead.
$info = pathinfo($file);
// Organize file info.
$item['name'] = $info['filename'];
$item['lname'] = strtolower($info['filename']);
$item['ext'] = $info['extension'];
if($info['extension'] == '') $item['ext'] = '.';
$item['bytes'] = $stat['size'];
$item['size'] = bytes_to_string($stat['size'], 2);
$item['mtime'] = $stat['mtime'];
// Add files to the file list...
if($info['extension'] != '')
{
array_push($file_list, $item);
}
// ...and folders to the folder list.
else
{
array_push($folder_list, $item);
}
// Clear stat() cache to free up memory (not really needed).
clearstatcache();
// Add this items file size to this folders total size
$total_size += $item['bytes'];
}
}
// Close the directory when finished.
closedir($handle);
}
// Sort folder list.
if($folder_list)
$folder_list = php_multisort($folder_list, $sort);
// Sort file list.
if($file_list)
$file_list = php_multisort($file_list, $sort);
// Calculate the total folder size
if($file_list && $folder_list)
$total_size = bytes_to_string($total_size, 2);
/**********************************************************************************************************************************/
/******************************************************************************************************************[ FUNCTIONS ]***/
/**
* http://us.php.net/manual/en/function.array-multisort.php#83117
*/
function php_multisort($data,$keys)
{
foreach ($data as $key => $row)
{
foreach ($keys as $k)
{
$cols[$k['key']][$key] = $row[$k['key']];
}
}
$idkeys = array_keys($data);
$i=0;
foreach ($keys as $k)
{
if($i>0){$sort.=',';}
$sort.='$cols['.$k['key'].']';
if($k['sort']){$sort.=',SORT_'.strtoupper($k['sort']);}
if($k['type']){$sort.=',SORT_'.strtoupper($k['type']);}
$i++;
}
$sort .= ',$idkeys';
$sort = 'array_multisort('.$sort.');';
eval($sort);
foreach($idkeys as $idkey)
{
$result[$idkey]=$data[$idkey];
}
return $result;
}
/**
* @ http://us3.php.net/manual/en/function.filesize.php#84652
*/
function bytes_to_string($size, $precision = 0) {
$sizes = array('YB', 'ZB', 'EB', 'PB', 'TB', 'GB', 'MB', 'KB', 'Bytes');
$total = count($sizes);
while($total-- && $size > 1024) $size /= 1024;
$return['num'] = round($size, $precision);
$return['str'] = $sizes[$total];
return $return;
}
/**
* @ http://us.php.net/manual/en/function.time.php#71342
*/
function time_ago($timestamp, $recursive = 0)
{
$current_time = time();
$difference = $current_time - $timestamp;
$periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
$lengths = array(1, 60, 3600, 86400, 604800, 2630880, 31570560, 315705600);
for ($val = sizeof($lengths) - 1; ($val >= 0) && (($number = $difference / $lengths[$val]) <= 1); $val--);
if ($val < 0) $val = 0;
$new_time = $current_time - ($difference % $lengths[$val]);
$number = floor($number);
if($number != 1)
{
$periods[$val] .= "s";
}
$text = sprintf("%d %s ", $number, $periods[$val]);
if (($recursive == 1) && ($val >= 1) && (($current_time - $new_time) > 0))
{
$text .= time_ago($new_time);
}
return $text;
}
/**********************************************************************************************************************************/
/*******************************************************************************************************************[ TEMPLATE ]***/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHPDL - PHP Directory Lister</title>
<style type="text/css">
body{
font-family: "Lucida Grande",Calibri,Arial;
font-size: 9pt;
color: #333;
background: #f8f8f8;
}
a{
color: #b00;
font-size: 11pt;
font-weight: bold;
text-decoration: none;
}
a:hover{
color: #000;
}
img{
vertical-align: bottom;
padding: 0 3px 0 0;
}
table{
margin: 0 auto;
padding: 0;
width: 600px;
}
table td{
padding: 5px;
}
thead td{
padding-left: 0;
font-family: "Trebuchet MS";
font-size: 11pt;
font-weight: bold;
}
tbody .folder td{
border: solid 1px #f8f8f8;
}
tbody .file td{
background: #fff;
border: solid 1px #ddd;
}
tbody .file td.size,
tbody .file td.time{
white-space: nowrap;
width: 1%;
padding: 5px 10px;
}
tbody .file td.size span{
color: #999;
font-size: 8pt;
}
tbody .file td.time{
color: #555;
}
tfoot td{
padding: 5px 0;
color: #777;
font-size: 8pt;
background: #f8f8f8;
border-color: #f8f8f8;
}
tfoot td.copy{
text-align: right;
white-space: nowrap;
}
tfoot td.cc{
padding: 40px;
text-align: center;
}
tfoot td.cc img{
padding: 0;
border: none;
}
</style>
</head>
<body>
<table cellpadding="0" cellspacing="1">
<thead>
<tr>
<td colspan="3">Directory listing for <?=$this_folder?></td>
</tr>
</thead>
<tfoot>
<tr>
<td class="total"><? if($folder_list): ?>This folder has <?=count($file_list)?> files totaling <?=$total_size['num']?> <?=$total_size['str']?> in size<? endif; ?></td>
<td colspan="2" class="copy"><a target="_blank" href="http://greg-j.com/phpdl/">PHPDL</a> created by <a target="_blank" href="http://greg-j.com">Greg Johnson</a></td>
</tr>
<tr>
<td colspan="3" class="cc"><a target="_blank" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img src="http://creativecommons.org/images/public/somerights20.png" alt="CC 3.0" /></a></td>
</tr>
</tfoot>
<tbody>
<!-- folders -->
<? if($folder_list): ?>
<? foreach($folder_list as $item) : ?>
<tr class="folder">
<td colspan="3" class="name"><img src="<?=$this_script?>?image=<?=$item['ext']?>" alt="<?=$item['ext']?>" /> <a href="<?=$item['name']?>/">./<?=$item['name']?></a></td>
</tr>
<? endforeach; ?>
<? endif; ?>
<!-- /folders -->
<!-- files -->
<? if($file_list): ?>
<? foreach($file_list as $item) : ?>
<tr class="file">
<td class="name"><img src="<?=$this_script?>?image=<?=$item['ext']?>" alt="<?=$item['ext']?>" /> <a href="<?=$item['name']?>.<?=$item['ext']?>"><?=$item['name']?>.<?=$item['ext']?></a></td>
<td class="size"><?=$item['size']['num']?><span><?=$item['size']['str']?></span></td>
<td class="time"><?=time_ago($item['mtime'])?> old</td>
</tr>
<? endforeach; ?>
<? endif; ?>
<!-- /files -->
</tbody>
</table>
</body>
</html>
-
12th Mar 2012, 09:58 PM #6Respected Member
Here is one I did not write just tweaked to add download... You can pass a path or place file in the folder you want the download the files.
PHP Code:<?php
function download($filename)
{
$err = '<p style="color:#990000">Sorry, the file you are requesting is unavailable.</p>';
if (!$filename) {
// if variable $filename is NULL or false display the message
echo $err;
} else {
// define the path to your download folder plus assign the file name
$path = $filename;
// check that file exists and is readable
if (file_exists($path) && is_readable($path)) {
// get the file size and send the http headers
$size = filesize($path);
header('Content-Type: application/octet-stream');
header('Content-Length: '.$size);
header('Content-Disposition: attachment; filename='.$filename);
header('Content-Transfer-Encoding: binary');
// open the file in binary read-only mode
// display the error messages if the file can?t be opened
$file = @ fopen($path, 'rb');
if ($file) {
// stream the file and exit the script when complete
fpassthru($file);
exit;
} else {
echo $err;
}
} else {
echo $err;
}
}
}
// block any attempt to the filesystem
if (isset($_GET['file']) && basename($_GET['file']) == $_GET['file']) {
$filename = $_GET['file'];
download($filename);
} else {
$filename = NULL;
}
if (isset($_GET['path']) && basename($_GET['path']) == $_GET['path']) {
$path = $_GET['path'];
download($filename);
} else {
$path = getcwd();
}
// open this directory
$myDirectory = opendir($path);
// get each entry
while($entryName = readdir($myDirectory)) {
$dirArray[] = $entryName;
}
// close directory
closedir($myDirectory);
// count elements in array
$indexCount = count($dirArray);
// sort them
sort($dirArray);
?>
<html>
<body>
<table style="margin-bottom: 1px;" border="0" cellpadding="6" cellspacing="1" width="90%">
<tbody>
<tr>
<th class="TableData" style="padding-left: 11px; padding-right: 1px;"
bgcolor="#dadce1" width="300" height="22">File Name
</th>
<th class="TableData" style="padding-left: 11px; padding-right: 1px;"
bgcolor="#dadce1" width="100" height="22">File Size
</th>
<th class="TableData" style="padding-left: 11px; padding-right: 1px;"
bgcolor="#dadce1" width="350" height="22">Date Uploaded
</th>
<th class="TableData" style="padding-left: 11px; padding-right: 1px;"
bgcolor="#dadce1" width="110" height="22">Download
</th>
<?php
for($i=0; $i < $indexCount; $i++) {
// don't list hidden files
if (substr("$dirArray[$i]", 0, 1) != "."){
?>
<tr>
<td class="Lebels" align="right" bgcolor="#e9ece9" >
<?php echo $dirArray[$i]; ?>
</td>
<?php
print("<td bgcolor=\"#e9ece9\">");
// We may want a file size. Note that you need to add path
if( filesize( $path . "/" . $dirArray[$i] ) >= 1024 ) {
// Size in kilobytes
print " " . round( filesize( $path . "/" . $dirArray[$i] ) / 1024, 1 ). " K<br />\n";
} elseif( filesize( $path . "/" . $dirArray[$i] ) >= 1048576 ) {
# Size in megabytes
print " " . round( filesize( $path . "/" . $dirArray[$i] ) / 1024 / 1024, 1 ) . " M<br />\n";
} else {
// Size in bytes
print " " . filesize( $path . "/" . $dirArray[$i] ) . " bytes<br />\n";
}
print("</td>");
?>
<td class="Values" bgcolor="#e9ece9" ><?php echo date ("F d Y H:i:s.", filemtime($path . "/" . $dirArray[$i])); ?>
</td>
<td class="Values" bgcolor="#e9ece9" >
<?php print("<a href='".$_SERVER['PHP_SELF']."?path=".$path."&file=".$dirArray[$i]."'>".$dirArray[$i]."</a>");?>
</td>
</tr>
<?php
}
}
print("</TABLE>\n");
?>
</body>
</html>
-
13th Mar 2012, 01:38 AM #7OPMemberWebsite's:
heroturko.biz softpk.com gfxtra.biz hotfilegfx.comi am add directory path show this error...
PHP Code:Warning: filesize(): stat failed for aventura-html.rar in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 222 Warning: fileinode(): stat failed for aventura-html.rar in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 224 Warning: filetype(): Lstat failed for aventura-html.rar in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 225 Warning: fileatime(): stat failed for aventura-html.rar in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 226 Warning: fileperms(): stat failed for aventura-html.rar in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 227 Warning: filesize(): stat failed for bobbsfilelist320.zip in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 222 Warning: fileinode(): stat failed for bobbsfilelist320.zip in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 224 Warning: filetype(): Lstat failed for bobbsfilelist320.zip in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 225 Warning: fileatime(): stat failed for bobbsfilelist320.zip in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 226 Warning: fileperms(): stat failed for bobbsfilelist320.zip in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 227 Warning: filesize(): stat failed for Book2.xlsx in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 222 Warning: fileinode(): stat failed for Book2.xlsx in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 224 Warning: filetype(): Lstat failed for Book2.xlsx in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 225 Warning: fileatime(): stat failed for Book2.xlsx in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 226 Warning: fileperms(): stat failed for Book2.xlsx in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 227 Warning: filesize(): stat failed for sdasdasdsadsadsadsad.doc in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 222 Warning: fileinode(): stat failed for sdasdasdsadsadsadsad.doc in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 224 Warning: filetype(): Lstat failed for sdasdasdsadsadsadsad.doc in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 225 Warning: fileatime(): stat failed for sdasdasdsadsadsadsad.doc in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 226 Warning: fileperms(): stat failed for sdasdasdsadsadsadsad.doc in G:\WampDeveloper\Websites\DefaultWebsite\webroot\test4\phpdl.php on line 227
please help me
PHP Code:<?php
/* get the actual directory path */
$pwd=getcwd();
echo "<thead>";
echo "<tr>";
/* open the current directory */
$handle=opendir("G:/WampDeveloper/Websites/DefaultWebsite/webroot/test4/portraits");
/* the table descriptions */
echo "<th>File Name</th><th>Type</th><th>Size</th><th>Date</th><th>Download</th>";
echo"</tr>";
echo"</thead>";
echo"<tbody>";
/* a while loop to get all files in the actual directory */
while (false !== ($file = readdir ($handle)))
{ if ($file != "." && $file != ".." && $file != "phpdl.php")
{ /* all needed file details */
$size=filesize($file);
$total=$size+$total;
$inode=fileinode($file);
$type=filetype($file);
$time=fileatime($file);
$perms=fileperms($file);
echo"<tr class='gradeX'>";
if ($type == "dir")
{
echo"<td><a href=$file>$file</a></td>"; }
else
{
echo"<td><a href=$file>$file</a></td>"; }
echo"<td>$type</td>";
echo"<td>$size</td>";
echo"<td>$time</td>";
echo"<td><a href=$file>Download</a></td>";
}
}
/* close the table */
echo"</tr>";
echo"</tbody>";
/* close the directory */
closedir($handle);
?>
-
13th Mar 2012, 02:39 AM #8Respected Member
those are warnings and the php should work.
here is the cause:
Be aware to use this function on files/dirs which are NOT writeable: you will get a warning like:
Warning: filesize() [function.filesize]: stat failed for /var/www/xxx/yyy.php in /var/www/xxx/yyy.php on line 123
-
13th Mar 2012, 02:52 AM #9MemberWebsite's:
sborg.usThis warning shows up coz you're passing only the file's name in $file variable. You need to pass the basepath (i.e. server path like
"G:/WampDeveloper/Websites/DefaultWebsite/webroot/test4/portraits/$file")
Tweaked your code a bit, try this one out:
PHP Code:<?php
/* get the actual directory path */
$pwd=getcwd();
/* Make sure you end the filepath with a slash */
$checkDir = "G:/WampDeveloper/Websites/DefaultWebsite/webroot/test4/portraits/";
echo "<thead>";
echo "<tr>";
/* open the current directory */
$handle=opendir($checkDir);
/* the table descriptions */
echo "<th>File Name</th><th>Type</th><th>Size</th><th>Date</th><th>Download</th>";
echo"</tr>";
echo"</thead>";
echo"<tbody>";
/* a while loop to get all files in the actual directory */
while (false !== ($file = readdir ($handle)))
{ if ($file != "." && $file != ".." && $file != "phpdl.php")
{ /* all needed file details */
$size=filesize($checkDir.$file);
$total=$size+$total;
$inode=fileinode($file);
$type=filetype($file);
$time=fileatime($file);
$perms=fileperms($file);
echo"<tr class='gradeX'>";
if ($type == "dir")
{
echo"<td><a href=$file>$file</a></td>"; }
else
{
echo"<td><a href=$file>$file</a></td>"; }
echo"<td>$type</td>";
echo"<td>$size</td>";
echo"<td>$time</td>";
echo"<td><a href=$file>Download</a></td>";
}
}
/* close the table */
echo"</tr>";
echo"</tbody>";
/* close the directory */
closedir($handle);
?>
V3g3ta | Halcyon | Abhi
-
13th Mar 2012, 03:23 AM #10OPMemberWebsite's:
heroturko.biz softpk.com gfxtra.biz hotfilegfx.com
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
[Selling] Excellent Matrimonial Script| Complete readymade Matrimony Script Available
By matriscript4u in forum Marketplace (Buy, Sell and Trade)Replies: 0Last Post: 23rd Oct 2012, 02:54 PM -
[Selling] Mp3 Search Engine, File Host, SMS Script, Arcade Script, PDF Search Script, and More!
By Fileze in forum Completed TransactionsReplies: 12Last Post: 13th Mar 2012, 02:23 PM -
Greasemonkey script: Megaupload Premium Multifetch Script
By Dman in forum Webmaster ResourcesReplies: 46Last Post: 15th Dec 2011, 01:07 AM -
[Selling] Rslinkgens Premium link generator script V1 -Most advanced and viral script
By vccshopper in forum Completed TransactionsReplies: 0Last Post: 24th Jun 2011, 08:10 PM -
[Selling] A.A.S. (Adult Automated Script For ClipBucket Video Script)
By tangi in forum Completed TransactionsReplies: 0Last Post: 25th Mar 2011, 12:45 PM
themaLeecher - leech and manage...
Version 5.03 released. Open older version (or...