2013-06-17 6 views
0

안녕하세요 안녕하세요. 형식을 통해 파일을 업로드하려고하면 다른 폴더로 이동 한 다음 이름을 인쇄하십시오. 그러나 doesnt 일은 이유를 모른다. 실종업로드 된 파일을 다른 폴더로 이동하는 방법

<form method="post" action='exercice.php' id="form1"> 
     <input type="file" name="files" id="files" onChange="submitForm();">    
</form> 
<?php 

if (isset($_FILES['files'])) 
{ 

    move_uploaded_file($_FILES['files']['tmp_name'], "uploaded/"); 
    echo $_FILES['files']['name']; 
} 


?> 

답변

3

형태 :

enctype="multipart/form-data" 

심판 : spec

+0

감사합니다.하지만 지금 내 폴더가 특정 폴더로 이동하지 않았습니다. 왜 –

+0

폴더 대 파일을 업로드하려고합니까? 이는 매우 심하게 지원되는 기능이며 다른 백엔드가 필요합니다. 자세한 내용은 다음을 참조하십시오. http://stackoverflow.com/questions/254251/what-is-the-best-way-to-upload-a-folder-to-a-website – jancha

0
<form method="post" action='exercice.php' id="form1"> 
     <input type="file" name="files" id="files" onChange="submitForm();">    
</form> 
<?php 

if (isset($_FILES['files'])) 
{ 

    move_uploaded_file($_FILES['files']['tmp_name'], "uploaded/".$_FILES['files']['name']); 
    echo $_FILES['files']['name']; 
} 

?> 

당신은 위의 그림과 같이 업로드 경로에 파일 이름을 포함해야합니다.

또한 업로드 (ajax) 코드는 어디에 있습니까? isset($_FILES['files'])이 true를 반환 했습니까?

관련 문제