PHP-Jquery image upload not working
<p>I'm trying to post form data through ajax</p>

<p><strong>form1.php</strong></p>

<p>I use request to get all URL parameter data</p>

<pre><code>$_REQUEST["Ename"];
$_REQUEST["eImg"];
</code></pre>

<p>To upload the image,i use this code <a href="http://www.9lessons.info/2011/08/ajax-image-upload-without-refreshing.html" rel="nofollow">http://www.9lessons.info/2011/08/ajax-image-upload-without-refreshing.html</a></p>

<p>In the above link,you can see the source code,in the place of $_FILES['photoimg']['name'];,i use $_FILES['image']['name']; but it is not uploading the file and giving success message.</p>

<pre><code>include('db.php');
session_start();
$session_id='1'; // User session id
$path = "uploads/";
</code></pre>

<p>I removed script that is marked with **</p>

<pre><code>$valid_formats = array("jpg", "png", "gif", "bmp","jpeg");
    **if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST")
    {**

$name = $_FILES['image']['name'];
$size = $_FILES['image']['size'];
if(strlen($name)) {
  list($txt, $ext) = explode(".", $name);
  if(in_array($ext,$valid_formats)) {
    if($size&lt;(1024*1024)) { // Image size max 1 Mb
      $actual_image_name = time().$session_id.".".$ext;
      $tmp = $_FILES['image']['tmp_name'];
      if(move_uploaded_file($tmp, $path.$actual_image_name)) {
        mysql_query("UPDATE users SET profile_image='$actual_image_name' WHERE uid='$session_id'");
        echo "&lt;img src='uploads/".$actual_image_name."' class='preview'&gt;";
      } else {
        echo "failed";
      } 
    } else {
      echo "Image file size max 1 MB";
    }
  } else {
    echo "Invalid file format.."; 
  }
}  **else {
  echo "Please select image..!";
  exit();
}**
</code></pre>
