0

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>

Edited by keloa

3
Contributors
4
Replies
34
Views
3 Years
Discussion Span
Last Post by keloa
0

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

Edited by keloa

0

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

0

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 !

Edited by keloa

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.