Hi
I have a problem with uploading files in php, and I don't know what is wrong :(

this is my code :

<?php
//require_once('inc/config.php');
?>
<html dir="rtl">
<head>
<title>تسجيل شركة جديدة</title>
<meta http-equiv="content" content="type/text" charset="UTF-8" />
</head>
<center>
<form action="register.php" method="POST" enctype="mulipart/form-data">
<input type="text"     name="username"         placeholder="اسم المستخدم" /><br />
<input type="password" name="password"         placeholder="كلمة المرور" /><br />
<input type="password" name="repassword"       placeholder="اعد كتابة كلمة المرور" /><br />
<input type="text"     name="company_name"     placeholder="إسم الشركة" /><br />
<input type="text"     name="company_phone"    placeholder="هاتف الشركة" /><br />
<input type="text"     name="company_location" placeholder="مكان الشركة" /><br />
شعار الشركة :<input type="file" name="company_logo" size="40" /> <br />
<input type="submit" value="تسجيل" />
</form>
</center>
<?php
$username           = $_POST['username'];
$password           = $_POST['password'];
$repassword         = $_POST['repassword'];
$company_name       = $_POST['company_name'];
$company_phone    = $_POST['company_phone'];
$company_location = $_POST['company_location']; 

//Uploading Files Variables Area//
if ($_FILES["file"]["error"] > 0) {
    echo "Error:" .$_FILES["file"]["error"] ."<br />";}
$company_logo = $_FILES["file"]["name"];
$logo_size    = $_FILES["file"]["size"];
$logo_type    = $_FILES["file"]["type"];
$logo_temp    = $_FILES["file"]["tmp_name"];
$logodir      = "logo/";
/*The End Of The Uploading variables Area*/
if(empty($username) or empty($password) or empty($repassword) or empty($company_name) or empty($company_phone) or empty($company_location)
 or empty($company_logo)) {

echo "الرجاء ملئ جميع الحقول";
}elseif($password != $repassword){
echo "حقول كلمة المرور غير متطابقة";
}elseif($logo_size > 2048) {
echo "حجم الشعار كبير جداً"."<br />"."الحجم الأقصى للملف هو 2MB";
}else{

$md5 = md5($password);
move_uploaded_file($logo_temp, $logodir.rand(1000,999999).$company_logo);
}
?>
</html>

I don't know what is wrong

What happens, or what doesn't happen? Any errors?

the file field seems to be empty ! in the empty check.The second problem is that the file doesn't go to the folder!

that happned to me when file is more then the permitted size in php apache settings, even it do not show an warning,

the file size is less than 1MB ! it is a small picture! and I've tried my code on my website and I'm facing the same problem !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.