Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
$dir = "pictures/";
$imgs = array(".jpg", ".png");
// errors should be handled
$dh = opendir($dir);
while(($file = readdir($dh)) !== false) {
if(!is_dir($dir . $file)) {
$ext = substr($file, strripos($file,'.'));
if(in_array(strtolower($ext),$imgs)) {
echo $file . "\n"; // handle img here
}
}
}
closedir($dh);
<?php
$dir = ("img/");
$opDir = opendir($dir);
while (($row = readdir($opDir)) !== false) {
if ($row != "." && $row != "..") {
if (!is_dir("move_file")) {
mkdir("move_file");
copy('img/' . $row, 'move_file/' . $row);
} else {
copy('img/' . $row, 'move_file/' . $row);
}
}
}
closedir($opDir);
?>
<?php
$path = 'files1' . DIRECTORY_SEPARATOR . '0' . DIRECTORY_SEPARATOR;
$newPath = 'files2' . DIRECTORY_SEPARATOR . '1' . DIRECTORY_SEPARATOR;
$i = 1;
if ($_POST['SUB1']) {
if (is_dir($path)) {
$openDir = opendir($path);
while (($file = readdir($openDir)) !== false) {
if ($file != '.' and $file != '..') {
//$i++;
ECHO '<pre>';
rename($path . $file, $newPath . $file);//rename($path . $file, $newPath . $i . '_' . $file);
ECHO '</pre>';
}
}
closedir($openDir);
}
}
if ($_POST['SUB11']) {
if (is_dir($newPath)) {
$openDir = opendir($newPath);
while (($file = readdir($openDir)) !== false) {
if ($file != '.' and $file != '..') {
//$i++;
ECHO '<pre>';
rename($newPath . $file, $path . $file);//rename($newPath . $file, $path . $i . '_' . $file);
ECHO '</pre>';
}
}
closedir($openDir);
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<center>
ДА ВЪРНА ЛИ В ИЗХОДЯЩ ВИД ?
<form name="bac" method="POST" enctype="multipart/form-data">
<input type="submit" value="ДА" name="yes" />
<input type="submit" value="НЕ" name="no" />
</form>
<div style="width:1024px;height:768px;border:1px gray solid;">
<div style="width:500px;height:760px;border:1px gray solid;float:left;margin:5px;">
директория 0 <br>
пътя до нея е : <?php echo $path; ?>
<hr>
<form name="premesti" method="POST" enctype="multipart/form-data">
<?php
if (is_dir($path)) {
$openDir = opendir($path);
while (($file = readdir($openDir)) !== false) {
if ($file != '.' and $file != '..') {
$i++;
ECHO '<pre>';
echo "filename: $file : filetype: " . filetype($path . $file) . "<br>";
ECHO '</pre>';
}
}
closedir($openDir);
}
?>
<br><br>
ДА ПРЕМЕСТЯ ЛИ СНИМКИТЕ В ДРУГАТА ДИРЕКТОРИЯ<BR>
<input type="submit" value="ДА" name="SUB1" /><input type="submit" value="НЕ" name="SUB2" />
</form>
</div>
<div style="width:500px;height:760px;border:1px gray solid;float:left;margin:5px;">
директория 1 <br>
пътя до нея е : <?php echo $newPath; ?>
<hr>
<form name="premesti" method="POST" enctype="multipart/form-data">
<?php
if (is_dir($newPath)) {
$openDir = opendir($newPath);
while (($file = readdir($openDir)) !== false) {
if ($file != '.' and $file != '..') {
$i++;
ECHO '<pre>';
echo "filename: $file : filetype: " . filetype($newPath . $file) . "<br>";
ECHO '</pre>';
}
}
closedir($openDir);
}
?>
<br><br>
ДА ПРЕМЕСТЯ ЛИ СНИМКИТЕ В ДРУГАТА ДИРЕКТОРИЯ<BR>
<input type="submit" value="ДА" name="SUB11" /><input type="submit" value="НЕ" name="SUB22" />
</form>
</div>
</div>
</center>
</body>
</html>