G
G
Good Samaritan2018-11-05 11:05:50
1C-Bitrix
Good Samaritan, 2018-11-05 11:05:50

Why aren't some images copied from a remote site?

Why CFile::MakeFileArray($href)Can't work out a link like:
www.td-kama.com/upload/iblock/1ac/%D0%98%D1%82%D0%...
It just doesn't copy this kind of link

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Gritsuk, 2018-11-05
@djamali

And try to save this image first in tmp, transfer the already saved image to MakeFileArray

$fileName = "asd.png";
$fileContent = file_get_contents("https://example.ru/file/path/{$fileName}");
if ($fileContent) {
    $tmpFile = $_SERVER["DOCUMENT_ROOT"] . "/upload/tmp/{$fileName}";
    if ($fileContent && file_put_contents($tmpFile, $fileContent)) {
        $fileArray = \CFile::MakeFileArray($tmpFile);
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question