Kod
<table>
<?php
$dir = opendir('upload');
while(false !== ($file = readdir($dir)))
if($file != '.' && $file != '..')
{
$allowedExtensions = array("txt", "rtf", "doc");
function isAllowedExtension($fileName) {
global $allowedExtensions;
return in_array(end(explode(".", $fileName)), $allowedExtensions);
}
if (isAllowedExtension($file['name']))
{
echo '<tr><td><center><a href="upload/' . $file . '">' . $file . '</a></center></td><td><center><img src="mini/minia.jpg" width=200 height=200></center></td></tr>';
}
else
{
echo '<tr><td><center><a href="upload/' . $file . '">' . $file . '</a></center></td><td><center><img src="upload/' . $file . '" width=200 height=200></center></td></tr>';
}
}
?>
</table>
<?php
$dir = opendir('upload');
while(false !== ($file = readdir($dir)))
if($file != '.' && $file != '..')
{
$allowedExtensions = array("txt", "rtf", "doc");
function isAllowedExtension($fileName) {
global $allowedExtensions;
return in_array(end(explode(".", $fileName)), $allowedExtensions);
}
if (isAllowedExtension($file['name']))
{
echo '<tr><td><center><a href="upload/' . $file . '">' . $file . '</a></center></td><td><center><img src="mini/minia.jpg" width=200 height=200></center></td></tr>';
}
else
{
echo '<tr><td><center><a href="upload/' . $file . '">' . $file . '</a></center></td><td><center><img src="upload/' . $file . '" width=200 height=200></center></td></tr>';
}
}
?>
</table>
Nie chce działać miało znaczyć, ze skrypt po prostu nie wykonuje się, mianowicie pokazuje błąd:
Cytat
warning: in_array() [function.in-array]: Wrong datatype for second argument in C:\userdata\homes\students\2008\84599\drupal-5.12\includes\common.inc(1355) : eval()'d code on line 14.
I szczerze to nie wiem o co chodzi;-]
Pomożecie ;] ?