1 <?php 2 $target_path = "./upload/";//接收文件目录 3 $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 4 if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { 5 echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; 6 } else{ 7 echo "There was an error uploading the file, please try again!" . $_FILES['uploadedfile']['error']; 8 } 9 ?>