| 태그 'php'에 해당되는 글 22건 |
| Post 방식으로 PHP 파일 업로드 구현. |
Tech 12/12/17 23:07 ( Translate this page  )
글 주소 : https://ohyung.net/651
참고한곳.
http://www.w3schools.com/php/php_file_upload.asp

upload 받는 php 파일.
소스 코드 타입 : PHP
 0)
    {
        echo "Return Code: " . $_FILES["file"]["error"] . "
";     }     else     {         echo "Upload: " . $_FILES["file"]["name"] . "
";         echo "Type: " . $_FILES["file"]["type"] . "
";         echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB
";         echo "Temp file: " . $_FILES["file"]["tmp_name"] . "
";         if (file_exists("uploads/" . $_FILES["file"]["name"]))         {             echo $_FILES["file"]["name"] . " already exists. ";         }         else         {             move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);             echo "Stored in: " . "uploads/" . $_FILES["file"]["name"];             if (file_exists("uploads/" . $_FILES["file"]["name"]))             {                 header('Content-Description: File Transfer');                 header('Content-Type: application/octet-stream');                 header('Content-Disposition: attachment; filename='.basename("uploads/" . $_FILES["file"]["name"]));                 header('Content-Transfer-Encoding: binary');                 header('Expires: 0');                 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');                 header('Pragma: public');                 header('Content-Length: ' . filesize("uploads/" . $_FILES["file"]["name"]));                 ob_clean();                 flush();                 readfile("uploads/" . $_FILES["file"]["name"]);                 exit;             }         }     } } else {     echo "Invalid file"; } ?>


...
| 이 포스트에 대한 이용규약 |
Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시 2.0 라이센스 에 따라 이용하실 수 있습니다.
This work is licensed under a Creative Commons Attribution 2.0 Korea LicenseLink in a new window.

| 트랙백 |
트랙백 주소 :: https://ohyung.net/rserver.php?mode=tb&sl=651