PHP file uploads doesnot read $_FILES['image'] -


this question has answer here:

i have input type

  <input class="btn btn-success" type="file" name="profile_image" style="margin-top:10px; margin-left:20px;"></input> 

user add image file here, , php code upload file

if(isset($_files['profile_image']))             {                 $image_type = $this->getimagetype($_files['profile_image']);                  if($image_type == 'image')                 {                     $extension = pathinfo($_files['profile_image']['name'], pathinfo_extension);                     $filename = '123_'.uniqid().'.'.$extension;                     move_uploaded_file($_files['profile_image']['tmp_name'], '../functions/images/images/'.$filename);                 }             } else             {                 $filename = 'default_profile_image.jpg';             } 

and getimagetype

public function getimagetype($file)     {         $imagemime = getimagesize($file['tmp_name']);         $type = explode('/', $imagemime['mime']);         return $type[0];     } 

but not read $_files['profile_image'] , rather moves else part. why not read $_files ? there missing?

add code in form tag
enctype="multipart/form-data"

<form action="upload.php" method="post" enctype="multipart/form-data"> 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -