메뉴 건너뛰기

프로그램언어

조회 수 229 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

<?php
  // form 파일 업로드(오직 method=post)
  // http://localhost/testphp/11.php
  // 아래 HTML tag에서 48라인인 method를 post형식으로 보낸 파라미터를 받습니다.
  // form안에 각 태그의 name으로 $_POST['name']으로 넘어옵니다.
 
  // $_FILES방식으로 받은 값 출력(오직 method=post)
  echo "<b>\$_FILES['form name'][deprecated]</b><br>\n";
  echo "파일 이름 : ".$_FILES['test']['name']."<br>\n";
  echo "파일 크기 : ".$_FILES['test']['size']."<br>\n";
  echo "파일 타입 : ".$_FILES['test']['type']."<br>\n";
  echo "파일 에러 : ".$_FILES['test']['error']."<br>\n";
  echo "임시 파일 : ".$_FILES['test']['tmp_name']."<br>\n";
  /* $_FILES['test']['error'] 코드값
    파일 전송 완료됨      - UPLOAD_ERR_OK: 0
    파일 php.ini max 큼   - UPLOAD_ERR_INI_SIZE: 1
    파일 MAX_FILE_SIZE 큼 - UPLOAD_ERR_FORM_SIZE: 2
    파일 전송 일부만      - UPLOAD_ERR_PARTIAL: 3
    파일 전송 안되음      - UPLOAD_ERR_NO_FILE: 4
    임시 폴더가 없음      - UPLOAD_ERR_NO_TMP_DIR: 6
    디스크 파일 쓰기 실패 - UPLOAD_ERR_CANT_WRITE: 7
    확장 파일 업로드 중지 - UPLOAD_ERR_EXTENSION: 8
  */
  // 파일 위치와 파일명 설정
  $now_uploadfile = getcwd()."/".$_FILES['test']['name'];
  // 업로드 처리
  if(move_uploaded_file($_FILES['test']['tmp_name'], $now_uploadfile)){
    echo getcwd()."경로에 파일을 업로드 하였습니다.<br>\n";
  }
  else if(!$_FILES['test']['error']){
    echo getcwd()."경로에 파일을 업로드 준비.<br>\n";
  }
  else{
    echo getcwd()."경로에 파일을 업로드 실패.<br>\n";
  }
  $HTML_tag1 =
  '<HTML>
     <HEAD>
       <script type="text/javascript" language="javascript">
       <!--
         function getgo(){
         location.href = "'.$_SERVER["PHP_SELF"].'";
       }
       //-->
       </script>
     </HEAD>
     <BODY>
     <form method="post" enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'">
     <input type="file" name="test" title="test"/>
     <input type="hidden" name="MAX_FILE_SIZE" value="20000"/>
     <input type="submit" value="전송"/>
     </form>
     <input type="button" value="초기화" onclick="getgo();">
     </BODY>
   </HTML>
  ';
  echo $HTML_tag1;
?>


  1. PHP 쉘 스크립트

    Date2021.03.26 Views832
    Read More
  2. php 암호화 복호화 , 간단한 암호화

    Date2023.01.12 Views367
    Read More
  3. PHP 에서의 소켓(Socket) 통신

    Date2014.04.12 Views20395
    Read More
  4. php 엑셀 다운로드 구현

    Date2017.03.07 Views29790
    Read More
  5. PHP 외부 XML 파싱 하기

    Date2019.06.24 Views1946
    Read More
  6. PHP 이미지 리사이즈 함수 imagecopyresized

    Date2023.01.12 Views212
    Read More
  7. php 이미지 리사이징 image resizing

    Date2023.01.12 Views259
    Read More
  8. PHP 특정 디렉토리에 있는 파일 갯수 구하기

    Date2018.07.19 Views5455
    Read More
  9. PHP 파일 다루기

    Date2015.04.14 Views22401
    Read More
  10. php 파일 다운로드 구현

    Date2014.02.27 Views19794
    Read More
  11. php 파일 다운로드 구현

    Date2014.04.12 Views21703
    Read More
  12. PHP 파일 업로드 FORM 처리

    Date2023.01.12 Views229
    Read More
  13. php 파일 확장자

    Date2014.02.27 Views20234
    Read More
  14. PHP 파일크기 단위 붙이기 (용량 변환) file size conversion source code

    Date2018.07.04 Views5804
    Read More
  15. PHP 하위 디렉토리 포함 디렉토리 리스트 출력

    Date2023.01.12 Views236
    Read More
  16. PHP 확장 모듈을 이용한 C 라이브러리 사용

    Date2018.10.27 Views3790
    Read More
  17. PHP 휴대폰번호 짜르기 (preg_replace) "-" 넣기. 형식바꾸기

    Date2018.07.04 Views4057
    Read More
  18. PHP, $_SERVER 변수

    Date2017.04.13 Views19505
    Read More
  19. php/asp에서 가상번호 부여와 가상번호를 거꾸로 적용

    Date2019.01.08 Views1429
    Read More
  20. PHPExcel 클래스를 이용해 Excel 2007~2010 의 xlsx 파일 읽기 (100만 행 까지)

    Date2017.03.06 Views21695
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 ... 17 Next
/ 17

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved