PHP 4

[ PHP ]

(!!! Teleportom!!!)
: fopen, msql_num_fields, socket_write ...


19.

POST
PUT

POST

PHP RFC-1867- ( - Netscape Navigator 3 , Microsoft Internet Explorer 3 Microsoft ). . , , , .

, PHP PUT, Netscape Composer Amaya- W3C. . " PUT".

:
19-1.
<form enctype="multipart/form-data" action="_URL_" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>

_URL_ PHP-. MAX_FILE_SIZE /file input field, . .

!

MAX_FILE_SIZE . . , ! PHP- maximum-size .

, , PHP . . track_vars , $HTTP_POST_FILES/$_FILES. , , register_globals . .

: track_vars , PHP 4.0.3. PHP 4.1.0, $_FILES $HTTP_POST_FILES.
$_FILES , global $_FILES .

$HTTP_POST_FILES/$_FILES .

$_FILES. , 'userfile' , :

$_FILES['userfile']['name']

.

$_FILES['userfile']['type']

mime- , . : "image/gif".

$_FILES['userfile']['size']

.

$_FILES['userfile']['tmp_name']

, .

: PHP 4.1.0 $HTTP_POST_VARS . PHP 3 $HTTP_POST_FILES.

register_globals php.ini, . , 'userfile', :

  • $userfile - , .

  • $userfile_name - .

  • $userfile_size - .

  • $userfile_type - mime- , . : "image/gif".

, "$userfile" , <input> type="file" . "userfile".

: register_globals = On .

, upload_tmp_dir php.ini. TMPDIR , PHP. putenv() - . , , .
19-2.

PHP 4 4.0.2. . is_uploaded_file() move_uploaded_file().

<?php 
//  PHP  4.1.0   $HTTP_POST_FILES  $_FILES.
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
    copy($_FILES['userfile']['tmp_name'], "/place/to/put/uploaded/file");
} else {
    echo "Possible file upload attack. Filename: " . $_FILES['userfile']['name'];
}
/* ...... */
move_uploaded_file($_FILES['userfile']['tmp_name'], "/place/to/put/uploaded/file");
?>

PHP-, , , , . , , $_FILES['userfile']['size'] , . $_FILES['userfile']['type'] , . , .

, () .


mysql php

: 3119 .

: - |  -