Uroci.net - !
Adobe Photoshop Adobe Illustrator Adobe Flash Adobe Fireworks DreamWeaver CSS HTML Corel Draw Image Ready PHP
PHP
SEO CMS Microsoft Windows Microsoft Word Microsoft Excel PowerPoint Microsoft Access Microsoft Publisher Linux Visual basic JavaScript Ajax 3ds Max Maya 3D C++ Sound Forge Gimp SWiSH

File Upload

PHP » PHP
nma   :    : 4321



Section #1
. , . bytes.

<?php
//SECTION #2
if ($temp_file_name) {
$size = filesize($temp_file_name);
if ($size < $kb) {
$file_size = "$size Bytes";
}
elseif ($size < $mb) {
$final = round($size/$kb,2);
$file_size = "$final KB";
}
elseif ($size < $gb) {
$final = round($size/$mb,2);
$file_size = "$final MB";
}
elseif($size < $tb) {
$final = round($size/$gb,2);
$file_size = "$final GB";
} else {
$final = round($size/$tb,2);
$file_size = "$final TB";
}
} else {
$file_size = "ERROR: NO FILE PASSED TO get_file_size()";
}
return $file_size;
}
?>


Section #2

. $temp_file_name , . $temp_file_name, bytes PHP filesize(). log file.

Function #5 ( Max File Size)

<?php
function get_max_size() {
$max_file_size = trim($this->max_file_size);
$kb = 1024;
$mb = 1024 * $kb;
$gb = 1024 * $mb;
$tb = 1024 * $gb;

if ($max_file_size) {
if ($max_file_size < $kb) {
$max_file_size = "max_file_size Bytes";
}
elseif ($max_file_size < $mb) {
$final = round($max_file_size/$kb,2);
$max_file_size = "$final KB";
}
elseif ($max_file_size < $gb) {
$final = round($max_file_size/$mb,2);
$max_file_size = "$final MB";
}
elseif($max_file_size < $tb) {
$final = round($max_file_size/$gb,2);
$max_file_size = "$final GB";
} else {
$final = round($max_file_size/$tb,2);
$max_file_size = "$final TB";
}
} else {
$max_file_size = "ERROR: NO SIZE PARAMETER PASSED TO get_max_size()";
}
return $max_file_size;
}
?>


, . , . , upload- file, . .

----------------------------
Function #6 (Validation of The User)


<?php
function validate_user() {
//SECTION #1
$banned_array = $this->banned_array;
$ip = trim($_SERVER['REMOTE_ADDR']);
$cpu = gethostbyaddr($ip);
$count = count($banned_array);

//SECTION #2
if ($count < 1) {
return true;
} else {
foreach($banned_array as $key => $value) {
if ($value == $ip ."-". $cpu) {
return false;
} else {
return true;
}}}}
?>


, upload-. class , . IP. , upload- , , , , . , upload- , , , upload- IP . , , upload .

<?php
function validate_user() {
//SECTION #1
$banned_array = $this->banned_array;
$ip = trim($_SERVER['REMOTE_ADDR']);
$cpu = gethostbyaddr($ip);
$count = count($banned_array);
?>



: «1 2 3 4 5 6 »

(1)

yahoo 24.02 2007 14:28.
upload- ' . $_FILES['upload']['name'] str_replace ?

,


© . 2006-2008. Created by: Site.bg
: IT | | . | Paparak.bg | | uchenik.com | TRAVEL | | AmAm.bg | . | | AnimeS-bg.com | | | | IT Light | Spodeli.net | - | IDG.BG | Teenproblem.net | - | Fresh-BG.com | Hanovete.com | Bulfleet.com | Mythlands.com | Ohoboho.com | .Com | News24 | Setcom.bg | Atol.bg | Elmaz.com | MobileBulgaria.com