PHP using a passed value to open a dir, not working

Posted by HadoukenGr on Stack Overflow See other posts from Stack Overflow or by HadoukenGr
Published on 2013-06-25T10:14:25Z Indexed on 2013/06/25 10:21 UTC
Read the original article Hit count: 178

Filed under:
|
|

This is my code

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Gallery</title>
    <script src="js/jquery-1.7.2.min.js"></script>
    <script src="js/lightbox.js"></script>
    <link href="css/lightbox.css" rel="stylesheet" />
</head>
<body> 
<?php
$value=$_GET["value"];
$handle = opendir("content/$value/gallery/");
while($file = readdir($handle))
{
    if($file !== '.' && $file !== '..')
    {
        do_something;
    }
}
?>

</body>
</html> 

Passing value "?a??????", gives Warning: opendir(content/?a??????/gallery/): failed to open dir: No such file or directory. But if i do this :

$handle = opendir("content/?a??????/gallery/");

it works fine.

Something to do with character encoding? How could i solve this? Thank you.

© Stack Overflow or respective owner

Related posts about php

Related posts about html