Загрузить ошибки. Не загружаются изображения.

Я пытаюсь загрузить uploadify для загрузки, но он возвращает несколько ошибок:

Вот ошибки:

<b>Warning</b>:  move_uploaded_file(/home/mydomain/public_html/uploadslogo.png) [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: failed to open stream: Permission denied in <b>/home/mydomain/public_html/uploadify/uploadify.php</b> on line <b>37</b><br />
<br />


<b>Warning</b>:  move_uploaded_file() [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: Unable to move '/tmp/phpvoUwxK' to '/home/mydomain/public_html/uploadslogo.png' in <b>/home/domain/public_html/uploadify/uploadify.php</b> on line <b>37</b><br />
1true

А вот код uploadify.php:

<?php

$targetFolder = '/uploads'; // Relative to the root

if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
    $targetFile = rtrim($targetPath,'/') . $_FILES['Filedata']['name'];

    // Validate the file type
    $fileTypes = array('jpg','jpeg','gif','png'); // File extensions
    $fileParts = pathinfo($_FILES['Filedata']['name']);

    if (in_array($fileParts['extension'],$fileTypes)) {
        move_uploaded_file($tempFile,$targetFile);
        echo '1';
    } else {
        echo 'Invalid file type.';
    }
}
?>

person Satch3000    schedule 06.11.2011    source источник


Ответы (1)


Вы пропустили косую черту после каталога uploads. Пытаться:

$targetFolder = '/uploads/'; // Relative to the root

Вы также захотите изменить:

$targetFile = rtrim($targetPath,'/') . $_FILES['Filedata']['name']; 

To:

$targetFile = $targetPath . $_FILES['Filedata']['name'];
person BenM    schedule 06.11.2011
comment
Изменил его, но все еще получаю ту же ошибку: ‹b›Предупреждение‹/b›: move_uploaded_file(/home/mydomain/public_html/uploadslogo.png) [‹a href='function.move-uploaded-file'›function.move- uploaded-file‹/a›]: не удалось открыть поток: Отказано в доступе в ‹b›/home/mydomain/public_html/uploadify/uploadify.php‹/b› на линии ‹b›37‹/b›‹br /› - person Satch3000; 06.11.2011
comment
Косая черта в конце удаляется следующей строкой: $targetFile = rtrim($targetPath,'/') . $_FILES['Данные файла']['имя']; Измените его на: $targetFile = $targetPath. $_FILES['Данные файла']['имя']; - person BenM; 06.11.2011