I Couldn't get $_POST['photo'] while echo. how can i rectify it.

The method is post action=""

if(isset($_POST['btn_submit'])){
      extract($_POST); 
          if(is_uploaded_file($_FILES['photo']['tmp_name'])){
            $temp=$_FILES['photo']['tmp_name'];
            $file=time()."-".$_FILES['photo']['name'];
            move_uploaded_file($temp,"uploads/".$file); 
            $file_sql.="photo='$file',";    
         } 
      $rs=mysqli_query($con,"INSERT INTO details set name='$name',email='$email',aadhar_number='$aadhar_number',$file_sql room_no='$room_no',age='$age',phone_number='".$_GET['mob_no']."',address='$address'");
      echo $_POST['photo'];

You can get information about a binary file submitted via a POST form from $_FILES['photo']

However, it's binary data. There's no PHP array that I know of that contains the binary data. The best you can do is use file_get_contents() or something of the sort to load the file from it's tmp location into a string, and then use header() to set the appropriate content-type header, and then echo out the string.

For example:

$tmp_location = $_FILES['photo']['tmp_name'];
$image_string = file_get_contents($tmp_location);
header('Content-Type: image/gif');
echo $image_string;
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.