S
S
Sergey Belyakov2018-11-12 15:52:07
linux
Sergey Belyakov, 2018-11-12 15:52:07

How to read files from a network folder using php?

Hello! I am implementing a program for reading audio files from a folder to a user's page.
The problem is that this folder is located on a remote computer on the same network as the server.
If you put the files locally, in the folder with the code, then everything reads fine, if remotely, this is what happens:

$directory = scandir('file://10.26.1.183//Records');
var_dump($directory);

the answer is this:
Warning: scandir(): remote host file access not supported, file://10.26.1.183//Records in /usr/local/www/apache24/data/clinicdoctor/controller/controller.php on line 191

Warning: scandir(file://10.26.1.183//Records): failed to open dir: no suitable wrapper could be found in /usr/local/www/apache24/data/clinicdoctor/controller/controller.php on line 191

Warning: scandir(): (errno 36): Operation now in progress in /usr/local/www/apache24/data/clinicdoctor/controller/controller.php on line 191
bool(false)

I also tried to mount the network folder directly to the folder with the code, then this is what is returned:
Code:
$directory = scandir(records); // монтированная сетевая папка с аудио файлами
            var_dump($directory);

Answer:
array(2) { [0]=> string(1) "." [1]=> string(2) ".." }

Although the operating system sees the contents of the connected network folder.
Operating system: FreeBSD
PHP version: PHP 5.5.32
How to read files from the network?
I try to read files from a Windows machine.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Softer, 2018-11-12
@grey_18_08

Mount samba to a folder and read the folder :)

P
pfg21, 2018-11-12
@pfg21

and on what protocol you are connected to a remote directory??
what is meant by file:// ??

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question