<!DOCTYPE html>
<html>
<head>
    <title>Registration Form</title>
    <link rel="stylesheet" media="screen" href="style.css" >
</head>
<body>
<div class="head" style="background:#343434;width:auto;height:100px">
<br/>
 <h2 Style="color:white"><center>NAVAL DOCKYARD, VISAKHAPATNAM-530 014 </br> APPLICATION FOR ABSORPTION OF TRADESMAN(SKILLED)</center> </h2>
</div>
 <form enctype="multipart/form-data" class="contact_form"  action=
"<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

  <ul>
        <h4>Registration Form </h4> 
<hr/>
    <li>
        <label for="name">APPLICANT PHOTO :<sup style="color: red;">*</sup></label>
           <input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
        <input name="userfile" type="file" />
    </li>
<li>
        <button class="submit" type="submit">Submit Form</button>
    </li>
  </ul>
  </form>
</body>
</html>
<?php

// check if a file was submitted

if ($_SERVER['REQUEST_METHOD'] == 'POST') 
{

    if(!isset($_FILES['userfile']))
    {
        echo '<p>Please select a file</p>';
    }
    else
    {
    echo "Varma";
    header("Content-type: image/jpeg");
    echo $_FILES['userfile'];
    }
}
?>

Quoted Text Here
i want to display the image which was posted in the form..please help me

else
    {
    echo "Varma";
    header("Content-type: image/jpeg");
    echo $_FILES['userfile'][name];
    $image=$_FILES['userfile']['name']
    }
    ?>
    <html>
            <head>
                <title></title>
            </head>
            <body>
            <img src="<?php echo $image;?>">
            </body>
            </html>

may be you have to try this in your else condition

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.