2011-11-06 3 views
0

내가 uploadify 업로드하려고 노력하고 있지만, 몇 가지 오류가 반환있어 다음 uploadify.php 코드 여기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 

된다 : 여기

하는 것은 오류입니다

<?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.'; 
    } 
} 
?> 

답변

1

당신 uploads 디렉토리 뒤에 슬래시가 없습니다. 시도 :

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

에 :

$targetFile = $targetPath . $_FILES['Filedata']['name']; 
+0

그것을 변경하지만 여전히 같은 오류가 점점 : 경고 : 인 move_uploaded_file을 (/ 홈/

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

당신은 또한 변경할 수 있습니다 mydomain/public_html/uploadslogo.png) [function.move-uploaded-file] : 스트림 열 수 없음 : 사용 권한이 거부되었습니다. /home/mydomain/public_html/uploadify/uploadify.php 온라인
Satch3000

+0

후행 슬래시가 다음 줄로 제거됩니다. $ targetFile = rtrim ($ targetPath, '/'). $ _FILES [ 'Filedata'] [ 'name']; 로 변경하십시오. $ targetFile = $ targetPath. $ _FILES [ 'Filedata'] [ 'name']; – BenM

관련 문제