انجمن سایت کلیدستان


رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
دسترسی به پوشه و زیر پوشه و ذخیره در دیتابیس

دسترسی به پوشه و زیر پوشه و ذخیره در دیتابیس

#3
کد list.php

کد:
<html>
<head>
    <title>7Learn.com > List Of Files In a folder</title>
    <style type="text/css">
        body, table {
            font-family: tahoma;
            font-size: 14px;
        }

        ul {
            list-style: none;
            line-height: 22px;
        }

        li.file {
            color: #2f6d13;
            background: transparent url("image/file.png") no-repeat left 3px;
            padding-left: 24px;
        }

        li.folder {
            color: #e6981c;
            background: transparent url("image/folder.png") no-repeat left 3px;
            padding-left: 24px;
        }

    </style>
    <script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script type="text/javascript" language="javascript">
    $(function () {
        $('#checkalls').click(function () {
            $(this).parents('#Checks').find(':checkbox').attr('checked', this.checked);
        });
    });
</script>
</head>
<body>
<!------
Code By : Loghman Avand
Url : www.7Learn.com
------->
<div id="Checks">
<form action="welcome.php" method="post">

<?php
function getFileList($folderName, $fileType = "")
{
            if (substr($folderName, strlen($folderName) - 1) != "/") {
        $folderName .= '/';
    }

    echo '<h3>List of '.$fileType.' files in folder : <span style="color:brown">' . $folderName . '</span></h3>';
    echo '<ul>';
        foreach (glob($folderName . '*' . $fileType) as $filename) {
        if (is_dir($filename)) {
            $type = 'folder';
        } else {
            $type = 'file';
        }
        $c=0;
        echo '<li  class="'.$type.'">' .
         str_replace($folderName, '', $filename) .'<input type="checkbox" name="'.$c.'" name="'.$c.'">'. '</li>';
        $c++;
        $d[]=$c;
        }
    echo '</ul>';
}


// call the function
getFileList('files'); // list all files
getFileList('files','.png'); // list only png files

echo '<input type="button" value="submit">';
 


?>
</div>
</form>
</body>
</html>

کد صفحه welcome

کد:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
$i=0;
foreach($_POST['check_list'] as $arr=>$value)
{
$myArrays[$i]=$value;
$checked=implode(', ', $myArrays);
echo($myArrays[$i]);

$i = $i+1;

//mysql_query("INSERT INTO myTable(favorites) VALUES('".$checked."') ");
}
?>
</body>
</html>
پاسخ


پیام‌های این موضوع
RE: دسترسی به پوشه و زیر پوشه و ذخیره در دیتابیس - توسط baran1391 - ۱۳۹۳/۰۳/۰۳, ۱۲:۴۶ ب.ظ

پرش به انجمن:


کاربران در حال بازدید این موضوع: 1 مهمان