PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, March 8, 2022

[FIXED] how to use UTF8 character in path Address for Scandir php

 March 08, 2022     php, utf-8, yii, yii2     No comments   

Issue

how to use UTF8 character in path Address for Scandir php

my folder name is: 61-تست تست

i have error in scandir and DirectoryIterator.

after change folder name to 61 fix my problem but in need full name.

$folder = '61-تست تست';
        $path    = 'files/'.$folder;

print_r(scandir($path));

        foreach (new \DirectoryIterator($path) as $file) {
            if(!$file->isDir())
            {
                echo $file->getFilename() . "<br>";
            }
        }

error:

    UnexpectedValueException

The system cannot find the file specified. (code: 2)

DirectoryIterator::__construct(D:/wamp64/www/project/web/files/61-تست تست,D:/wamp64/www/project/web/files/61-تست تست): The system cannot find the file specified. (code: 2)

Solution

ScanDir good work in PHP 5.6 LINUX but upload files only with FTP and dont work in PHP 5.6 windows for fix this in windows you are use WFIO ext or Upgrade to PHP 7.1



Answered By - user3770797
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing