| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/Strategy/AH/ |
Upload File : |
<html>
<head>
<title>Upload</title>
</head>
<body>
<?php if(!empty($message)) { echo "<p>{$message}</p>"; } ?>
<form action="upload1.php" enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="35000000" />
<!-- การ up ขนาดของไฟล์ 1 ล้านเท่ากับ 1 MB -->
<input type="file" name="file_upload" />
<input type="submit" name="submit" value="Upload" />
</form>
</body>
</html>
<?php if(!empty($message)) { echo "<p>{$message}</p>"; } ?>
<?php
$upload_errors = array(
UPLOAD_ERR_OK => "No errors.",
UPLOAD_ERR_INI_SIZE => "Larger than upload_max_filesize.",
UPLOAD_ERR_FORM_SIZE => "Larger than form MAX_FILE_SIZE.",
UPLOAD_ERR_PARTIAL => "Partial upload.",
UPLOAD_ERR_NO_FILE => "No file.",
UPLOAD_ERR_NO_TMP_DIR => "No temporary directory.",
UPLOAD_ERR_CANT_WRITE => "Can't write to disk.",
UPLOAD_ERR_EXTENSION => "File upload stopped by extension."
);
if(isset($_POST['submit'])) {
$tmp_file = $_FILES['file_upload']['tmp_name'];
$target_file = basename($_FILES['file_upload']['name']);
$upload_dir = "file";
if(move_uploaded_file($tmp_file, $upload_dir."/".$target_file)) {
$message = "File uploaded successfully.";
// echo $message;
} else {
$error = $_FILES['file_upload']['error'];
$message = $upload_errors[$error];
}
}
if(!empty($message)) { echo "<p>{$message}</p>"; }
?>